tfork - create new thread under current process
Synopsis
Description
#include <std.h>
pid_t tfork(voidfun startfun, ulong arg);
tfork() creates a new thread running under the current process. A thread, unlike a process, shares the address space, permissions, and open files with all other threads of the current process.A thread starts running at the function pointed to by the startfun argument to tfork(); this function is entered with the single argument arg available. This function should not return to its "caller"; exit(2) should be used when the thread wishes to complete.
tfork()s return value is the thread process ID of the new thread. Note that a thread process ID is local to the PID of the containing process; see notify(2) for an example of selecting a thread within a process.
TFORK (2) |