003 Linux System ProgrammingIssues, queries and suggestions related to Linux, Linux Programming, IPC, Interprocess Communication, Synchronization, Semaphore, System Programming, Linux Software Development. » 003.11.POSIX-Threads
Each thread is creates inside process using pthread_create() API.
int pthread_create(pthread_t *thread,attributes,void* (*start_routine),(void*)arg)
first argument is pointer of type pthread_t it assign unique ID to thread and store it to memory location pointed by first argument. This thread id is used to uniquely identify the each thread within the process.
second arguments is attributes to thread which specifies the thread behavior and properties like what is the stack size for the thread ,whether thread is joinable or detached threads.
Third arguments is function pointer to thread function that contain routines or task which thread is intended to perform.
fourth arguments is arguments that is to passed to threads function if it is required input data to perform its task.