Advanced Programming in the UNIX® Environment
ptg10805159 Section 10.18 systemFunction 367 We first see whether the default action will occur; if so, we flush all the standar ...
ptg10805159 368 Signals Chapter 10 #include "apue.h" static void sig_int(int signo) { printf("caught SIGINT\n"); } static void s ...
ptg10805159 Section 10.18 systemFunction 369 Recall from Section 9.6 that typing the interrupt character causes the interrupt si ...
ptg10805159 370 Signals Chapter 10 if (sigaction(SIGINT, &ignore, &saveintr) < 0) return(-1); if (sigaction(SIGQUIT, ...
ptg10805159 Section 10.18 systemFunction 371 POSIX.1 states that ifwaitorwaitpidreturns the status of a child process whileSIGCH ...
ptg10805159 372 Signals Chapter 10 When we terminate thesleepcall with the interrupt signal, thepr_exitfunction (Figure8.5) thin ...
ptg10805159 Section 10.19 sleep,nanosleep,andclock_nanosleepFunctions 373 10.19 sleep, nanosleep,and clock_nanosleep Functions W ...
ptg10805159 374 Signals Chapter 10 sleep(unsigned int seconds) { struct sigaction newact, oldact; sigset_t newmask, oldmask, sus ...
ptg10805159 Section 10.19 sleep,nanosleep,andclock_nanosleepFunctions 375 to sleep in seconds and nanoseconds. If the sleep inte ...
ptg10805159 376 Signals Chapter 10 10.20 sigqueueFunction In Section 10.8 we said that most UNIX systems don’t queue signals.Wit ...
ptg10805159 Section 10.21 Job-Control Signals 377 Mac OS X 10.6.8 doesn’t supportsigqueueor real-time signals. On Solaris 10,sig ...
ptg10805159 378 Signals Chapter 10 #include "apue.h" #define BUFFSIZE 1024 static void sig_tstp(int signo) /* signal handler for ...
ptg10805159 Section 10.22 Signal Names and Numbers 379 should be set toSIG_IGN.Infact, the shell doesn’t explicitly ignorethis s ...
ptg10805159 380 Signals Chapter 10 It operates in a similar manner to thepsignalfunction. Although this function has access to m ...
ptg10805159 Chapter 10 Exercises 381 10.23 Summary Signals areused in most nontrivial applications. An understanding of the hows ...
ptg10805159 382 Signals Chapter 10 10.10 Write a program that callssleep(60)in an infinite loop. Every five times through the lo ...
ptg10805159 11 Threads 11.1 Introduction We discussed processes in earlier chapters. We learned about the environment of a UNIX ...
ptg10805159 384 Threads Chapter 11 and 17. Threads, in contrast, automatically have access to the same memory address space and ...
ptg10805159 Section 11.4 Thread Creation 385 #include <pthread.h> int pthread_equal(pthread_ttid1,pthread_t tid2); Returns ...
ptg10805159 386 Threads Chapter 11 thread 2 thread 1 thread 3 work queue job TID 1 job TID 3 job TID 2 job TID 3 master thread F ...
«
16
17
18
19
20
21
22
23
24
25
»
Free download pdf