Read/write Lock
The book has the reader's code, I really do not bother to realize it again. Similar to the previous code.
Multi-threaded asynchronous signal processing
int Pthread_kill (pthread_t __threadid, int __signo) : Sends a signal. A second parameter of 0 indicates that the specified thread is detected for existence. Successful return 0.
int pthread_sigmask (int __how, __const __sigset_t *__restrict __newmask, __sigset_t * __restrict __oldmask) : Set adjustment Use the thread's signal mask.
Parameter one: Presentation methods, including Sig_block, Sig_unblock, Sig_setmask
There is an example in the book, too lazy to copy ....
Thread Property Control
The thread property structure includes
pthread_t pthread_self (void) : Gets the thread ID. The ID is unique within a process, but may be the same in a different process.
syscall (Sys_gettid) : Gets the PID of the thread, is unique. Cannot view with PS command
int Pthread_attr_init (pthread_attr_t *__attr) : Initialize Thread Property Object
The default property values are:
int Pthread_attr_destroy (pthread_attr_t *__attr) : Destroys a thread property that has already been initialized
Get/Set thread detach state or can connect state
int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate) : Set Detachstate Property
pthread_create_detached : In a detached state
pthread_create_joinable : Can connect status (default)
int pthread_attr_getdetachstate (__const pthread_attr_t *__attr, int *__detachstate) : Get Detachstate Property
Stack-related properties
int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize) : Sets the stack size pthread_stack_min represents the minimum value, The other numbers are the exact values.
int pthread_attr_getstacksize (__const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) : Get stack size
int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr) : Set Stack address
int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) : Get the Stack address
int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize) : Sets the stack protection size. For overflow protection.
int pthread_attr_getguardsize (__const pthread_attr_t *__attr, size_t *__guardsize) : Gets the stack protection size.
"Linux Advanced Programming" (12th) Linux multithreaded Programming 4