Monday, October 31, 2016

C Library Function – threads

The <threads.h> header shall define the following function(s).

Initialization Functions:
call_once(C11) void call_once( once_flag* flag, void (*func)(void) );

Condition variable Functions:
cnd_init(C11) int cnd_init( cnd_t* cond );
cnd_signal(C11) int cnd_signal( cnd_t *cond );
cnd_broadcast(C11) int cnd_broadcast( cnd_t *cond );
cnd_wait(C11) int cnd_wait( cnd_t* cond, mtx_t* mutex );
cnd_timedwait(C11) int cnd_timedwait( cnd_t* restrict cond, mtx_t* restrict mutex, const struct timespec* restrict time_point );
cnd_destroy(C11) void cnd_destroy( cnd_t* cond );

Mutex Functions:
mtx_init(C11) int mtx_init( mtx_t* mutex, int type );
mtx_lock(C11) int mtx_lock( mtx_t* mutex );
mtx_timedlock(C11) int mtx_timedlock( mtx_t *restrict mutex, const struct timespec *restrict time_point );
mtx_trylock(C11) int mtx_trylock( mtx_t *mutex );
mtx_unlock(C11) int mtx_unlock( mtx_t *mutex );
mtx_destroy(C11) void mtx_destroy( mtx_t *mutex );

Thread Functions:
thrd_create(C11) int thrd_create( thrd_t *thr, thrd_start_t func, void *arg );
thrd_equal(C11) int thrd_equal( thrd_t lhs, thrd_t rhs );
thrd_current(C11) thrd_t thrd_current(void);
thrd_sleep(C11) int thrd_sleep( const struct timespec* time_point, struct timespec* remaining );
thrd_yield(C11) void thrd_yield(void);
thrd_exit(C11) void thrd_exit( int res );
thrd_detach(C11) int thrd_detach( thrd_t thr );
thrd_join(C11) int thrd_join( thrd_t thr, int *res );

Thread-specific storage Functions:
tss_create(C11) int tss_create( tss_t* tss_key, tss_dtor_t destructor );
tss_get(C11) void *tss_get( tss_t tss_key );
tss_set(C11) int tss_set( tss_t tss_id, void *val );
tss_delete(C11) void tss_delete( tss_t tss_id );



Related topics:
Library Functions in C   |   Standard Library in C   |   Header Files in C   |   Functions in C   |   Keywords in C   |   Data Types in C   |   Pointers in C

List of topics: C Programming

No comments:

Post a Comment