5.13 Operating System Threads
|(require ffi/unsafe/os-thread)||package: base|
Added in version 188.8.131.52 of package base.
(call-in-os-thread thunk) → void?
thunk : (-> any)
The thunk is run in atomic mode, and it must not inspect its continuation or use any Racket thread functions (such as thread or current-thread), any Racket synchronization functions (such as semaphore-post or sync), or any parameters (such as current-output-port). Variables may be safely mutated with set!, and vectors, mutable pairs, boxes, mutable structure fields, and eq?- and eqv?-based hash tables can be mutated, but the visibility of mutations to other threads is unspecified except as synchronized through os-semaphore-wait and os-semaphore-post.
(make-os-semaphore) → any
(os-semaphore-post sema) → void?
sema : any/c
(os-semaphore-wait sema) → void?
sema : any/c
5.13.1 Operating System Asynchronous Channels
|(require ffi/unsafe/os-async-channel)||package: base|
An asynchronous operating-system channel is a synchronizable event, so can it can be used with sync to receive a value in a Racket thread. Other threads must use os-async-channel-try-get or os-async-channel-get.
When a thread is blocked on an otherwise inaccessible asynchronous channel that was produced by make-os-async-channel, the thread is not available for garbage collection. That’s different from a thread is blocked on a regular Racket channel or a place channel.
Added in version 184.108.40.206 of package base.
(os-async-channel? v) → boolean?
v : any/c
(os-async-channel-put ch v) → void?
ch : os-async-channel? v : any/c
(os-async-channel-try-get ch [default-v]) → any/c
ch : os-async-channel? default-v : any/c = #f
(os-async-channel-get ch) → any/c
ch : os-async-channel?