An interface for the portable implementation of threads as defined in C11 standard supplemented with some extensions.
More...
|
Portable implementation of the call-once concept.
|
#define | CHSV_ONCE_INIT RESOLVE_NAMESPACE(::Chusov::ExecutionControl::Implementation) ImplOnceFlagInit() |
| A macro which is expanded to a value used to initialize a flag of type chsv_once_t. More...
|
|
void | chsv_once (chsv_once_t *flag, void(*func)(void)) |
| The function uses a specified once flag to ensure that a specified function is called exactly once, the first time the function is called with that value of the flag. More...
|
|
bool | chsv_once_ex (chsv_once_t *flag, void(*func)(void *), void *pParam) |
| The function uses a specified once flag to ensure that a specified function is called exactly once, the first time the function is called with that value of the flag. This is an extension to the C11 standard conforming chsv_once function. More...
|
|
|
Portable implementation of thread management functions.
|
#define | CHSV_THREAD_STACK_SIZE (1024 * 1024) |
| A size of a stack memory allocated for created threads.
|
|
typedef struct Implementation ::chsv_thrd_impl_t | chsv_thrd_t |
| A type of a thread identifier.
|
|
typedef int(* | chsv_thrd_start_t) (void *) |
| A type of a pointer to a user defined thread procedure.
|
|
int | chsv_thrd_create (chsv_thrd_t *pThread, chsv_thrd_start_t pStartAddress, void *pArg) noexcept |
| Creates a new thread executing the specified function with the specified argument. More...
|
|
chsv_thrd_t | chsv_thrd_current (void) noexcept |
| Returns an identifier of the calling thread. More...
|
|
int | chsv_thrd_detach (chsv_thrd_t thr) noexcept |
| Specifies that the specified thread has to be disposed by the host operating system when the thread terminates. More...
|
|
int | chsv_thrd_equal (chsv_thrd_t thr0, chsv_thrd_t thr1) noexcept |
| Determines whether the two identifies refer to the same thread. More...
|
|
void | chsv_thrd_exit (int res) noexcept |
| Terminates execution of the calling thread setting its result code to the specified value. More...
|
|
int | chsv_thrd_join (chsv_thrd_t thr, int *res) noexcept |
| Joins the specified thread to the current one blocking until its completion. More...
|
|
void | chsv_thrd_sleep (const chsv_xtime *xt) noexcept |
| Suspends an execution of the calling thread until the specified time has passed. More...
|
|
void | chsv_thrd_sleepfor (unsigned long cMilliseconds) noexcept |
| Suspends an execution of the calling thread for the specified amount of time. More...
|
|
void | chsv_thrd_yield (void) noexcept |
| Endeavours to permit other threads to run, even if the current thread would ordinarily continue to run. More...
|
|
|
Portable implementation of thread-specific storage mechanisms.
|
#define | CHSV_TSS_DTOR_ITERATIONS 4 |
| A number of iterations of thread-specific storage destruction loop. See chsv_tss_create.
|
|
typedef void(* | chsv_tss_dtor_t) (void *) |
| A type of a pointer to a user-defined function used as a destructor for a thread-specific storage.
|
|
typedef unsigned long | chsv_tss_t |
| A type of an object identifying a thread-specific storage key.
|
|
int | chsv_tss_create (chsv_tss_t *pKey, chsv_tss_dtor_t dtor) noexcept |
| Creates a thread-specific storage (TSS) key with an optional destructor used during releasing thread specific storages associated with the key. More...
|
|
void | chsv_tss_delete (chsv_tss_t key) noexcept |
| Deletes the specified key of the thread-specific storage (TSS) and releases any associated resources. More...
|
|
void * | chsv_tss_get (chsv_tss_t key) noexcept |
| Returns the value for the current thread held in the thread-specific storage (TSS) identified by the specified key. More...
|
|
int | chsv_tss_set (chsv_tss_t key, void *pData) noexcept |
| Sets the value for the current thread held in the thread-specific storage identified by the specified key. More...
|
|
|
Portable implementation of a condition-variable primitive.
|
typedef struct Implementation ::impl_cnd | chsv_cnd_t |
| A type of an object identifying a condition variable.
|
|
int | chsv_cnd_init (chsv_cnd_t *pCnd) noexcept |
| Creates a condition variable and writes its descriptor to a specified location. More...
|
|
void | chsv_cnd_destroy (chsv_cnd_t *pCnd) noexcept |
| Closes a specified condition variable object and releases associated resources. More...
|
|
int | chsv_cnd_signal (chsv_cnd_t *pCnd) noexcept |
| Unblocks one of the threads that are blocked on the specified condition variable at the time of the call. More...
|
|
int | chsv_cnd_broadcast (chsv_cnd_t *pCnd) noexcept |
| Unblocks all of the threads that are blocked on the specified condition variable at the time of the call. More...
|
|
int | chsv_cnd_wait (chsv_cnd_t *pCnd, chsv_mtx_t *pMtx) noexcept |
| Atomically unlocks the specified mutex and endeavours to block until the specified condition variable is signalled by a call to chsv_cnd_signal or to chsv_cnd_broadcast. More...
|
|
int | chsv_cnd_timedwait (chsv_cnd_t *pCnd, chsv_mtx_t *pMtx, const chsv_xtime *pXt) noexcept |
| Atomically unlocks the specified mutex and endeavours to block until the specified condition variable is signalled by a call to chsv_cnd_signal or to chsv_cnd_broadcast, or until after the time specified by the chsv_xtime object. More...
|
|
int | chsv_cnd_timedwaitfor (chsv_cnd_t *pCnd, chsv_mtx_t *pMtx, unsigned long cMilliseconds) noexcept |
| Atomically unlocks the specified mutex and endeavours to block until the specified condition variable is signalled by a call to chsv_cnd_signal or to chsv_cnd_broadcast, or until the specified time elapses. More...
|
|
|
Portable implementation of event synchronization primitive.
|
typedef struct ::Chusov::ExecutionControl::Implementation ::impl_event | chsv_event_t |
| A type of an event identifier. This is a chsvlib extension.
|
|
int | chsv_event_init (chsv_event_t *pEvent, bool fManualReset, bool fInitialState) noexcept |
| Creates an event object of the specified type. More...
|
|
int | chsv_event_wait (chsv_event_t *pEvent) noexcept |
| Blocks the calling thread until the specified event is signalled. More...
|
|
int | chsv_event_timedwait (chsv_event_t *pEvent, chsv_xtime *xt) noexcept |
| Blocks the calling thread until either the specified event is signalled or until after the time specified by the chsv_xtime object. More...
|
|
int | chsv_event_timedwaitfor (chsv_event_t *pEvent, unsigned long cMilliseconds) noexcept |
| Blocks the calling thread until either the specified event is signalled or until the specified amount of time elapses. More...
|
|
int | chsv_event_set (chsv_event_t *pEvent) noexcept |
| Sets the specified event to a signalled state. More...
|
|
int | chsv_event_reset (chsv_event_t *pEvent) noexcept |
| Sets the specified event to a nonsignalled state. More...
|
|
int | chsv_event_pulse (chsv_event_t *pEvent) noexcept |
| Sets the specified event to the signalled state, releasing appropriate number of threads that are waiting for the signal, and resets the event back to the nonsignalled state. More...
|
|
void | chsv_event_destroy (chsv_event_t *pEvent) noexcept |
| Releases resources associated with the specified event object. More...
|
|
An interface for the portable implementation of threads as defined in C11 standard supplemented with some extensions.
See Process management and initialization. ("Execution control group") for more detailed information.