Creates a new thread.
#include <thread.h> int thr_create ( void *stack_base, size_t stack_size, void *(*start_routine)(void *), void *arg, long flags, thread_t *new_thr);
(IN) Points to the allocated stack for the thread. If NULL, the minimum size stack is allocated. If non-NULL, the value must be equal to or greater than the minimum stack size (see thr_minstack). If a user-allocated stack is used, the stack needs to be aligned on a 32-bit boundary.
(IN) Specifies the size of the thread stack.
(IN) Points to the function on which the thread should start executing.
(IN) Points to an argument passed to the start_routine.
(IN) Specifies the thread attributes. You can set it to zero or a bitwise OR of the following. If zero, the thread is created as a joinable thread.
(OUT) Points to the thread ID of the newly created thread.
If successful, returns 0. Otherwise, returns one of the following error codes:
The thread is created executing start_routine with arg as its sole argument. If the start_routine returns, the effect is as if thr_exit was called, using the return value of start_routine as the exit status. The thread in which main was originally invoked differs from this process. When it returns from main, the effect is as if exit was called, using the return value of main as the exit status.
The signal state of the new thread is initialized as follows:
The signal mask is inherited from the creating thread.
The set of signals pending for the new thread is empty.
If thr_create fails, no new thread is created, and the contents of the new_thr parameter are undefined.