pthread_create (pthread_t * thread , const pthread_attr_t * attr , void *
(*start_routine)(void *) , void *
The pthread_create function creates a thread with the attributes specified in attr. If attr is NULL then the default attributes are used. The new thread starts execution in start_routine, which is passed the single specified argument.
If the pthread_create function succeeds it returns 0 and puts the new thread id into thread, otherwise it returns -1 and sets an error number as follows:
EAGAIN if there is insufficient memory to create another thread
ENOMEM if there is insufficient memory for the thread's stack
EINVAL if a value specified by attr is invalid
The function pthread_create calls calloc to allocate memory for the thread's data, and calls malloc to allocates the thread's stack.
The sizes are as follows:
Size of thread data = 35 words on the M1750, 132 bytes on the ERC32.
Default stack size = 1024 words on the M1750, and 8192 bytes on the ERC32.
pthread_detach (pthread_t * thread_ptr );
The pthread_detach function marks the threads's internal data structure for deletion.
The pthread_detach function returns zero if the call is successful, otherwise it sets errno to EINVAL and returns -1.
pthread_equal (pthread_t t1 , pthread_t
The pthread_equal function compares the two threads t1 and t2.
The pthread_equal function returns one if the two threads are the same thread, and zero otherwise.
The pthread_exit function terminates the calling thread returning the value given by status to any thread that has called pthread_join for the calling thread.
The pthread_exit function returns no value.
pthread_join (pthread_t thread , any_t *
The pthread_join function causes the calling thread to wait for the given thread's termination. If the parameter status is not null then it receives the return value of the terminating thread.
The pthread_join function returns zero if the call is successful, otherwise it sets errno to EINVAL and returns -1.