Advanced Programming in the UNIX® Environment
ptg10805159 Section 12.6 Thread-Specific Data 447 routines,errnois redefined as thread-private data. Thus one thread making a ca ...
ptg10805159 448 Thread Control Chapter 12 #include <pthread.h> int pthread_key_delete(pthread_key_tkey); Returns: 0 if OK, ...
ptg10805159 Section 12.6 Thread-Specific Data 449 void thread_init(void) { err = pthread_key_create(&key, destructor); } int ...
ptg10805159 450 Thread Control Chapter 12 extern char **environ; static void thread_init(void) { pthread_key_create(&key, fr ...
ptg10805159 Section 12.7 Cancel Options 451 12.7 Cancel Options Twothread attributes that arenot included in thepthread_attr_tst ...
ptg10805159 452 Thread Control Chapter 12 access fseeko getwchar putwc catclose fsetpos glob putwchar catgets fstat iconv_close ...
ptg10805159 Section 12.8 Threads and Signals 453 Several of the functions listed in Figure12.15, such as the ones dealing with m ...
ptg10805159 454 Thread Control Chapter 12 #include <signal.h> int pthread_sigmask(inthow,const sigset_t *restrict set, sig ...
ptg10805159 Section 12.8 Threads and Signals 455 caught (the process has established a signal handler by usingsigaction,for exam ...
ptg10805159 456 Thread Control Chapter 12 case SIGQUIT: pthread_mutex_lock(&lock); quitflag = 1; pthread_mutex_unlock(&l ...
ptg10805159 Section 12.9 Threads andfork 457 in the main thread of control to check the value of the flag and atomically release ...
ptg10805159 458 Thread Control Chapter 12 #include <pthread.h> int pthread_atfork(void (*prepare)(void), void (*parent)(vo ...
ptg10805159 Section 12.9 Threads andfork 459 A child process is created. Thechildfork handler from module B is called to releas ...
ptg10805159 460 Thread Control Chapter 12 int err; printf("parent unlocking locks...\n"); if ((err = pthread_mutex_unlock(&l ...
ptg10805159 Section 12.10 Threads and I/O 461 In Figure12.17, we define two mutexes, lock1and lock2.Thepreparefork handler acqui ...
ptg10805159 462 Thread Control Chapter 12 Thread A Thread B lseek(fd, 300, SEEK_SET); lseek(fd, 700, SEEK_SET); read(fd, buf1, 1 ...
ptg10805159 13 Daemon Processes 13.1 Introduction Daemons areprocesses that live for a long time. They areoften started when the ...
ptg10805159 464 Daemon Processes Chapter 13 Under System V–based systems, a similar command isps -efj.(In an attempt to improve ...
ptg10805159 Section 13.2 Daemon Characteristics 465 In the samplepsoutput, kernel daemons appear with their names in square brac ...
ptg10805159 466 Daemon Processes Chapter 13 13.3 Coding Rules Some basic rules to coding a daemon prevent unwanted interactions ...
«
20
21
22
23
24
25
26
27
28
29
»
Free download pdf