Module thread

Source
Expand description

Runtime interface for threads.

Functions§

twz_rt_futex_wait
If the futex word pointed to by word is equal to expected, put the thread to sleep. This operation is atomic – the thread is enqueued on the sleep queue first, before the equality check. Returns false on timeout, true on all other cases.
twz_rt_futex_wake
Wake up up to max threads waiting on word. If max is None, wake up all threads.
twz_rt_join_thread
Wait for a thread to exit, optionally timing out.
twz_rt_set_thread_name
Set the name of the calling thread.
twz_rt_sleep
Sleep the calling thread for duration dur.
twz_rt_spawn_thread
Spawn a thread. On success, that thread starts executing concurrently with the return of this function.
twz_rt_tls_get_addr
Get the address of a given TLS variable.
twz_rt_yield
Yield the calling thread.

Type Aliases§

AtomicFutexWord
Atomic futex word, for a linux-like thread wait.
FutexWord
Type of a linux-like wait point.
ThreadId
Runtime-internal thread ID.
ThreadSpawnArgs
Arguments to spawn.
TlsDesc
TLS desc
TlsIndex
Index of a TLS variable.