| THREAD_FORK(9) | Kernel Developer's Manual | THREAD_FORK(9) |
thread_fork —
create a new thread inside a process
#include
<sys/types.h>
#include <sys/proc.h>
int
thread_fork(struct proc *p1,
void *stack, void *tcb,
pid_t *tidptr, register_t
*retval);
thread_fork()
creates a new thread out of p1, which should be the
current thread. This function is used to implement the
__tfork(3) system call.
stack, which must not be
NULL, will be used as the initial value of the new
thread's stack pointer.
If tcb is not NULL,
it will be used as the initial address of the new thread's TCB (thread
control block).
If tidptr is not
NULL, the TID of the new thread will be copied out
there on success. This is guaranteed to be done before the new thread is
started.
On successful completion the TID of the new thread will be stored in *retval.
Upon successful completion of the operation,
thread_fork() returns 0. Otherwise, the following
error values are returned:
EAGAIN]ENOMEM]EINVAL]NULL.The thread_fork() function appeared in
OpenBSD 6.1.
| February 15, 2017 | Debian |