Adelsbach Enhanced Threading Library

Manual Pages (DD-00013-001)

Enhanced Threading Library > thrd_create (3)
HTML TXT PDF PS
thrd_create(3) Library Functions Manual thrd_create(3)

thrd_createcreate a thread

library “threads”
#include <threads.h>

typedef int (*thrd_start_t)(void*);

int
thrd_create(thrd_t *thrd, thrd_start_t fn, void *arg);

The function () will create a thread in the current process and store it's identifier in thrd. The thread will execute the given start callback function fn and pass it the given opaque pointer arg.

The thread will continue executing concurrently until either the given function fn returns or thrd_exit(3) has been called from within the thread.

Any thread-local variables that have been created with tss_create(3) will be initialized to NULL for the new thread.

A thread will inherit the signal mask of it's process.

The function thrd_create() will return thrd_success on success, if there is insufficient memory thrd_nomem will be returned. In any other error case thrd_error will be returned.

thrd_exit(3) thrd_sleep(3) thrd_yield(3) thrd_equal(3) thrd_detach(3) thrd_current(3) thrd_join(3)

The thrd_create() function first appeared in the C11 standard ISO/IEC 9899:2011.

Jan Adelsbach <jan@jadelsbach.de>

May 9, 2020 Debian