thrd_create(3) | Library Functions Manual | thrd_create(3) |
NAME
thrd_create
—
create a thread
SYNOPSIS
library “threads”
#include <threads.h>
typedef int (*thrd_start_t)(void*);
int
thrd_create
(thrd_t
*thrd, thrd_start_t
fn, void *arg);
DESCRIPTION
The function
thrd_create
()
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.
RETURN VALUES
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.
SEE ALSO
thrd_exit(3) thrd_sleep(3) thrd_yield(3) thrd_equal(3) thrd_detach(3) thrd_current(3) thrd_join(3)
HISTORY
The thrd_create
() function first appeared
in the C11 standard ISO/IEC 9899:2011.
AUTHORS
Jan Adelsbach <jan@jadelsbach.de>
May 9, 2020 | Debian |