| |
| Code Example 2-1 A Simple Threads Program | 21 |
| Code Example 2-2 Thread-Specific Data--Global but Private | 24 |
| Code Example 2-3 Turning Global References Into Private References . | 25 |
| Code Example 2-4 Initializing the Thread-Specific Data | 26 |
| Code Example 2-5 thr_create() Creates Thread With New Signal Mask 31 |
| Code Example 3-1 Mutex Lock Example | 43 |
| Code Example 3-2 Deadlock | 44 |
| Code Example 3-3 Conditional Locking | 45 |
| Code Example 3-4 Singly Linked List Structure | 46 |
| Code Example 3-5 Singly Linked List with Nested Locking | 47 |
| Code Example 3-6 Circular Linked List Structure | 47 |
| Code Example 3-7 Circular Linked List With Nested Locking | 48 |
| Code Example 3-8 Example Using cond_wait(3T) and cond_signal(3T) 52 |
| Code Example 3-9 Timed Condition Wait | 53 |
| Code Example 3-10 Condition Variable Broadcast | 54 |
| Code Example 3-11 The Producer/Consumer Problem and Condition Variables | 57 |
| |
| Code Example 3-12 The Producer/Consumer Problem--the Producer | 58 |
| Code Example 3-13 The Producer/Consumer Problem--the Consumer . | 59 |
| Code Example 3-14 Read/Write Bank Account | 66 |
| Code Example 3-15 The Producer/Consumer Problem With Semaphores 73 |
| Code Example 3-16 The Producer/Consumer Problem--the Producer | 74 |
| Code Example 3-17 The Producer/Consumer Problem--the Consumer . | 74 |
| Code Example 3-18 The Producer/Consumer Problem, Using USYNC_PROCESS | 76 |
| Code Example 4-1 Continuation Semantics | 88 |
| Code Example 4-2 Asynchronous Signals and sigwait(2) | 91 |
| Code Example 4-3 Completion Semantics | 92 |
| Code Example 4-4 Condition Variables and Interrupted Waits | 95 |
| Code Example 5-1 Degrees of Thread Safety | 102 |
| Code Example 7-1 Global Variables and errno | 114 |
| Code Example 7-2 The gethostbyname() Problem | 115 |
| Code Example 7-3 The printf() Problem | 116 |
| Code Example 7-4 Testing the Invariant With assert(3X) | 118 |
| Code Example 7-5 The Producer/Consumer Problem--Shared Memory Multiprocessors | 126 |
| Code Example 7-6 Mutual Exclusion for Two Threads? | 128 |
| Code Example 7-7 Multithreaded Cooperation (Barrier Synchronization) 129 |
| Code Example A-1 File Copy Example With a Semaphore | 132 |
| Code Example A-2 Matrix Multiplication | 133 |
| Code Example A-3 RPC rstat Program With Multithreaded Client | 137 |
| Code Example A-4 Window Server | 142 |