Overview:
1: The process is the smallest unit of the schedule, and is the smallest unit of resource allocation.
2: Threads in the process are shared global variables as well as memory .
3: Sharing: Instructions, removing private data, signal processing and routines, operating environment
Source: http://www.cnblogs.com/forstudy/archive/2012/04/05/2433853.html
Function Description:
Description
The ID number used to get this thread----ID is a long unsigned integer
------------------------------Split Line--------------------------------
Description
Used to determine if thread IDs are equal
------------------------------Split Line--------------------------------
Description
Creates a thread where the thread function is the thread's entrance. The thread will start when it is created.
------------------------------Split Line--------------------------------
Description
Thread Exit Function
------------------------------Split Line--------------------------------
Description
Wait for thread th to finish executing:
------------------------------Split Line--------------------------------
Description
Pthread_setcancelstate (pthread_cancel_enable,null); This function setting can be canceled by another thread
The above function allows the thread to be requested to cancel the thread.
Synchronization mode:
Mutual exclusion lock function
Mutex initialization: Pthread_mutex_init ()
Mutex Lock: Pthread_mutex_lock ()
Lock exclusion: Pthread_mutex_trylock ()
Mutex unlock: Pthread_mutex_unlock ()
Eliminate mutex: Pthread_mutex_destroy ()
semaphore function
Sem_init () creates a semaphore and initializes it
Sem_wait () and Sem_trywait (): p operation, reduce the value of the semaphore by one when the semaphore is greater than zero
Difference: If the semaphore is less than zero, sem_wait () will block the thread, and sem_trywait () will immediately return
Sem_post (): v operation, the value of the semaphore plus a simultaneous signal to wake up the waiting thread
Sem_getvalue (): Gets the value of the semaphore
Sem_destroy (): Delete semaphore
Condition variable function:
See: http://blog.chinaunix.net/uid-21411227-id-1826890.html
Initializing condition variables Pthread_cond_init
block on the condition variable pthread_cond_wait
unblock on a condition variable pthread_cond_signal
block until the specified time pthread_cond_timedwait
Free All threads that are blocked Pthread_cond_broadcast
releasing a condition variable Pthread_cond_destroy
Linux Programming----Threading Programming