► |  | The Racket Reference

1 | Language Model
2 | Notation for Documentation
3 | Syntactic Forms
4 | Datatypes
5 | Structures
6 | Classes and Objects
7 | Units
8 | Contracts
9 | Pattern Matching
10 | Control Flow
11 | Concurrency and Parallelism
12 | Macros
13 | Input and Output
14 | Reflection and Security
15 | Operating System
16 | Memory Management
17 | Unsafe Operations
18 | Running Racket
| Bibliography
| Index

▼ | 10 | Control Flow

10.1 | Multiple Values
10.2 | Exceptions
10.3 | Delayed Evaluation
10.4 | Continuations
10.5 | Continuation Marks
10.6 | Breaks
10.7 | Exiting

On this page:

exit
exit-handler
executable-yield-handler

top ← prev up next →

#### 10.7`` Exiting

> procedure (exit [v]) → any
> v : any/c = #t

Passes v to the current exit handler. If the exit handler does not escape or terminate the thread, #<void> is returned.

> parameter (exit-handler) → (any/c . -> . any)
> (exit-handler proc) → void?
> proc : (any/c . -> . any)

A parameter that determines the current exit handler. The exit handler is called by exit.

The default exit handler in the Racket executable takes any argument and shuts down the OS-level Racket process. The argument is used as the OS-level exit code if it is an exact integer between 1 and 255 (which normally means “failure”); otherwise, the exit code is 0, (which normally means “success”).

> parameter (executable-yield-handler) → (byte? . -> . any)
> (executable-yield-handler proc) → void?
> proc : (byte? . -> . any)

A parameter that determines a procedure to be called as the Racket process is about to exit normally. The procedure associated with this parameter is not called when exit (or, more precisely, the default exit handler) is used to exit early. The argument to the handler is the status code that is returned to the system on exit. The default executable-yield handler simply returns #<void>.

The scheme/gui/base library sets this parameter to wait until all frames are closed, timers stopped, and queued events handled in the main eventspace. See scheme/gui/base for more information.

top ← prev up next →