Interface
allocate
/*
static */ os_thread_key_t allocate()
Allocates a new key for
thread-specific data. See release() , get()
, and set() .
Throws: os_thread_toolkit_error
get
/*
static */ void* get( const os_thread_key_t& handle
)
Returns the
thread-specific data associated with handle .
Throws: os_thread_toolkit_error
milli_sleep
/*
static */ void milli_sleep( long milliseconds
)
Suspends the current
thread for a duration of at least milliseconds .
Throws: os_thread_toolkit_error
priority
/*
static */ void priority( os_thread_priority::level_t level
)
Changes the current
thread's priority to level .
Throws: os_thread_toolkit_error
priority
/*
static */ os_thread_priority::level_t priority()
Returns the priority
level of the current thread.
Throws: os_thread_toolkit_error
release
/*
static */ void release( os_thread_key_t& handle
)
Releases the
thread-specific data associated with handle . Use allocate()
to create handles.
Throws: os_thread_toolkit_error
set
/*
static */ void set( const os_thread_key_t& handle
, void* data
)
Stores thread-specific
data. The value of the data pointer is associated
with the handle (created with allocate()
) and the current thread. Subsequent calls to get()
, with the same handle called in the context of
this thread, return data .
Throws: os_thread_toolkit_error
sleep
/*
static */ void sleep( int seconds )
Suspends the current
thread for a duration of at least seconds .
Throws: os_thread_toolkit_error
terminate
/*
static */ void terminate( void* status )
Terminates the current
thread, setting its exit status to status . If the
current thread is not detached, its ID and exit status are retained until
another thread waits for it. If the current thread is the initial thread,
the process terminates with an exit code of status
.
Throws: os_thread_toolkit_error
tid
/*
static */ os_thread_t tid()
Returns a handle to the
current thread.
Throws: os_thread_toolkit_error
wait_for_any_thread
/* static */ void*
wait_for_any_thread( os_thread_t*
thread )
Suspends the current
thread until any other thread terminates, then returns the terminating
thread's exit status. The handle of the terminating thread is stored in *
thread (if non-null).
Throws: os_thread_toolkit_error
wait_for_thread
/*
static */ void* wait_for_thread( os_thread_t thread
)
Suspends the current
thread until the specified thread terminates, then
returns the terminating thread's exit status.
Throws: os_thread_toolkit_error
yield
/*
static */ void yield()
If a thread with the same
priority is waiting to execute, suspends this thread and allows the waiting
thread to execute.