#include <pthread.h>
|
int
pthread_create (pthread_t *threadhdl, const pthread_attr_t *attrib, void *(*begin_routine)(void *), void *param); |
The thread is created executing begin_routine with param as its sole argument. If the begin_routine returns, the effect is as if there was an implicit call to pthread_exit using the return value of start_routine as the exit status. Note that the thread in which main was originally invoked differs from this. When it returns from main, the effect is as if there was an implicit call to exit using the return value of main as the exit status.
void *a_thread_func_1_1(void*) { return NULL; } int XYZ() { pthread_t new_th; if(pthread_create(&new_th, NULL, a_thread_func_1_1, NULL) != 0) { perror("Error creating thread\n"); return -1; } }
[EAGAIN] | |
The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process [PTHREAD_THREADS_MAX] would be exceeded. | |
[EINVAL] | |
The value specified by attrib is invalid. | |
© 2005-2007 Nokia |