Namespaces
Variants
Views
Actions

Difference between revisions of "c/thread"

From cppreference.com
< c
(Mutual exclusion)
(Mutual exclusion)
Line 32: Line 32:
 
{{dcl list enum | c/thread/mtx_types | title=mtx_plain<br>mtx_recursive<br>mtx_timed | defines the type of a mutex}}
 
{{dcl list enum | c/thread/mtx_types | title=mtx_plain<br>mtx_recursive<br>mtx_timed | defines the type of a mutex}}
 
{{dcl list h2 | Call once}}
 
{{dcl list h2 | Call once}}
{{dcl list item | {{tt|once_flag}} | the type of the flag used by call_once | notes={{mark c11}}}}
+
{{dcl list item | {{ttb|once_flag}} | the type of the flag used by call_once | notes={{mark c11}}}}
 
{{dcl list macro const | c/thread/ONCE_FLAG_INIT | initializes a once_flag | notes={{mark c11}}}}
 
{{dcl list macro const | c/thread/ONCE_FLAG_INIT | initializes a once_flag | notes={{mark c11}}}}
 
{{dcl list fun | c/thread/call_once| calls a function exactly once | notes={{mark c11}} }}
 
{{dcl list fun | c/thread/call_once| calls a function exactly once | notes={{mark c11}} }}

Revision as of 08:32, 3 August 2012

If the macro constant __STDC_NO_THREADS__(C11) is defined by the compiler, the header <threads.h> and all of the names listed here are not provided.

Contents

Threads

Template:c/thread/dcl list thrd createTemplate:c/thread/dcl list thrd detachTemplate:c/thread/dcl list thrd currentTemplate:c/thread/dcl list thrd equalTemplate:c/thread/dcl list thrd exitTemplate:c/thread/dcl list thrd joinTemplate:c/thread/dcl list thrd sleepTemplate:c/thread/dcl list thrd yieldTemplate:c/thread/dcl list thrd errors
Defined in header <threads.h>
thrd_t a type identifying a thread
thrd_start_t
(C11)
function pointer type passed to thrd_create
(typedef)

Mutual exclusion

Defined in header <threads.h>
mtx_t mutex identifier
creates a mutex
(function)
blocks until locks a mutex
(function)
blocks until locks a mutex or times out
(function)
locks a mutex or returns without blocking if already locked
(function)
unlocks a mutex
(function)
destroys a mutex
(function)
defines the type of a mutex
(enum)
Call once
once_flag the type of the flag used by call_once
initializes a once_flag
(macro constant)
calls a function exactly once
(function)

Condition variables

Defined in header <threads.h>
cnd_t condition variable identifier
creates a condition variable
(function)
unblocks one thread blocked on a condition variable
(function)
unblocks all threads blocked on a condition variable
(function)
blocks on a condition variable
(function)
blocks on a condition variable, with a timeout
(function)
destroys a condition variable
(function)

Thread-local storage

Defined in header <threads.h>
thread local type macro
(macro constant)
tss_t thread-specific storage pointer
tss_dtor_t function pointer type used for TSS destructor
maximum number of times destructors are called
(macro constant)
creates thread-specific storage pointer with a given destructor
(function)
reads from thread-specific storage
(function)
write to thread-specific storage
(function)
releases the resources held by a given thread-specific pointer
(function)