Multithreaded Programming Guide
  Cerca solo questo libro
Scarica il manuale in formato PDF

............................Code Samples

Code Example 2-1 A Simple Threads Program16
Code Example 2-2 Thread-Specific Data--Global but Private22
Code Example 2-3 Turning Global References Into Private References .23
Code Example 2-4 Initializing the Thread-Specific Data24
Code Example 3-1 Creating a Detached Thread48
Code Example 3-2 Creating a Prioritized Thread59
Code Example 4-1 Mutex Lock Example82
Code Example 4-2 Deadlock83
Code Example 4-3 Conditional Locking84
Code Example 4-4 Singly Linked List Structure84
Code Example 4-5 Singly-Linked List with Nested Locking85
Code Example 4-6 Circular Linked List Structure86
Code Example 4-7 Circular Linked List With Nested Locking86
Code Example 4-8 Using pthread_cond_wait() and pthread_cond_signal()97
Code Example 4-9 Timed Condition Wait99
Code Example 4-10 Condition Variable Broadcast100
Code Example 4-11 The Producer/Consumer Problem and Condition Variables103
Code Example 4-12 The Producer/Consumer Problem - the Producer104
Code Example 4-13 The Producer/Consumer Problem - the Consumer . 105
Code Example 4-14 The Producer/Consumer Problem With Semaphores 114
Code Example 4-15 The Producer/Consumer Problem - the Producer115
Code Example 4-16 The Producer/Consumer Problem - the Consumer . 115
Code Example 4-17 Synchronization Across Process Boundaries116
Code Example 5-1 Continuation Semantics134
Code Example 5-2 Asynchronous Signals and sigwait(2)138
Code Example 5-3 Completion Semantics139
Code Example 5-4 Condition Variables and Interrupted Waits143
Code Example 6-1 Degrees of Thread Safety150
Code Example 9-1 Read/Write Bank Account199
Code Example 9-2 The Producer/Consumer Problem, Using USYNC_PROCESS222
Code Example 10-1 Global Variables and errno226
Code Example 10-2 The gethostbyname() Problem227
Code Example 10-3 The printf() Problem228
Code Example 10-4 Testing the Invariant With assert(3X)231
Code Example 10-5 The Producer/Consumer Problem--Shared Memory Multiprocessors241
Code Example 10-6 Mutual Exclusion for Two Threads?243
Code Example 10-7 Multithreaded Cooperation (Barrier Synchronization) 244
Code Example A-1 Solaris Threads Example: barrier.c249