|
NAMEcall_once , cnd_broadcast ,
cnd_destroy , cnd_init ,
cnd_signal , cnd_timedwait ,
cnd_wait , mtx_destroy ,
mtx_init , mtx_lock ,
mtx_timedlock , mtx_trylock ,
mtx_unlock , thrd_create ,
thrd_current , thrd_detach ,
thrd_equal , thrd_exit ,
thrd_join , thrd_sleep ,
thrd_yield , tss_create ,
tss_delete , tss_get ,
tss_set —
C11 threads interface
LIBRARYC11 Threads Library (libstdthreads, -lstdthreads)SYNOPSIS#include <threads.h>
void
int
void
int
int
int
int
void
int
int
int
int
int
int
thrd_t
int
int
_Noreturn void
int
int
void
int
void
void *
int
DESCRIPTIONAs of ISO/IEC 9899:2011 (“ISO C11”), the C standard includes an API for writing multithreaded applications. Since POSIX.1 already includes a threading API that is used by virtually any multithreaded application, the interface provided by the C standard can be considered superfluous.In this implementation, the threading interface is therefore implemented as a light-weight layer on top of existing interfaces. The functions to which these routines are mapped, are listed in the following table. Please refer to the documentation of the POSIX equivalent functions for more information.
DIFFERENCES WITH POSIX EQUIVALENTSThethrd_exit () function returns an integer value to the
thread calling thrd_join (), whereas the
pthread_exit () function uses a pointer.
The mutex created by RETURN VALUESIf successful, thecnd_broadcast (),
cnd_init (), cnd_signal (),
cnd_timedwait (), cnd_wait (),
mtx_init (), mtx_lock (),
mtx_timedlock (),
mtx_trylock (), mtx_unlock (),
thrd_create (), thrd_detach (),
thrd_equal (), thrd_join (),
thrd_sleep (), tss_create () and
tss_set () functions return
thrd_success . Otherwise an error code will be returned
to indicate the error.
The The ERRORSThecnd_init () and thrd_create ()
functions will fail if:
The
The
In all other cases, these functions may fail by returning general
error code SEE ALSOnanosleep(2), pthread(3)STANDARDSThese functions are expected to conform to ISO/IEC 9899:2011 (“ISO C11”).HISTORYThese functions appeared in FreeBSD 10.0.AUTHORSEd Schouten <ed@FreeBSD.org>
Visit the GSP FreeBSD Man Page Interface. |