HP OpenVMS Systems Documentation

Content starts here

Guide to the POSIX Threads Library

Begin Index

Contents (summary)
Preface Preface
Part 1 Compaq POSIX Threads Library Overview and Programming Guidelines
Chapter 1 Introducing Multithreaded Programming
Chapter 2 Objects and Operations
Chapter 3 Programming with Threads
Chapter 4 Writing Thread-Safe Libraries
Chapter 5 Using the Exceptions Package
Chapter 6 Examples
Part 2 POSIX.1 (pthread) Routines Reference
Part 3 Compaq Proprietary Interfaces: tis Routines Reference
Part 4 Appendixes
Appendix A Considerations for Tru64 UNIX Systems
Appendix B Considerations for OpenVMS Systems
Appendix C Debugging Multithreaded Applications
Appendix D Migrating from the cma Interface
Appendix E Migrating from the d4 Interface


Preface Preface
Part 1
Part 1 Compaq POSIX Threads Library Overview and Programming Guidelines
Chapter 1
1 Introducing Multithreaded Programming
     1.1     Advantages of Using Threads
     1.2     Overview of Threads
     1.3     Thread Execution
     1.4     Functional Models for Multithreaded Programming
         1.4.1         Boss/Worker Model
         1.4.2         Work Crew Model
         1.4.3         Pipelining Model
         1.4.4         Combination of Functional Models
     1.5     Programming Issues for Multithreaded Programs
     1.6     POSIX Threads Libraries and Interfaces
         1.6.1         The pthread Multithreading Interface
                Optionally Implemented POSIX.1 Routines
         1.6.2         Thread-Independent Services Interface
         1.6.3         Undocumented and Obsolete Interfaces
                The cma Interface
                The d4 (DCEthread) Interfaces
Chapter 2
2 Objects and Operations
     2.1     Threads and Synchronization Objects
     2.2     Attributes Objects
     2.3     Thread Operations
         2.3.1         Creating a Thread
         2.3.2         Setting the Attributes of a New Thread
                Setting the Inherit Scheduling Attribute
                Setting the Scheduling Policy Attribute
                        Techniques for Setting the Scheduling Policy Attribute
                        Comparing Throughput and Real-Time Policies
                        Portability of Scheduling Policy Settings
                Setting the Scheduling Parameters Attribute
                Setting the Stacksize Attribute
                Setting the Stack Address Attribute
                Setting the Guardsize Attribute
                Setting the Contention Scope Attribute
         2.3.3         Terminating a Thread
                Cleanup Handlers
         2.3.4         Detaching and Destroying a Thread
         2.3.5         Joining With a Thread
         2.3.6         Scheduling a Thread
                Calculating the Scheduling Priority
                Effects of Scheduling Policy
         2.3.7         Canceling a Thread
                Thread Cancelation Implemented Using Exceptions
                Thread Return Value After Cancelation
                Controlling Thread Cancelation
                Deferred Cancelation Points
                Cleanup from Deferred Cancelation
                Cleanup from Asynchronous Cancelation
                Example of Thread Cancelation Code
     2.4     Synchronization Objects
         2.4.1         Mutexes
                Normal Mutex
                Default Mutex
                Recursive Mutex
                Errorcheck Mutex
                Mutex Operations
                Mutex Attributes
         2.4.2         Condition Variables
         2.4.3         Condition Variable Attributes
         2.4.4         Read-Write Locks
                Thread Priority and Writer Precedence for Read-Write Locks
                Initializing and Destroying a Read-Write Lock
                Read-Write Lock Attributes
     2.5     Process-Shared Synchronization Objects
         2.5.1         Programming Considerations
         2.5.2         Process-Shared Mutexes
         2.5.3         Process-Shared Condition Variables
         2.5.4         Process-Shared Read-Write Locks
     2.6     Thread-Specific Data
Chapter 3
3 Programming with Threads
     3.1     Designing Code for Asynchronous Execution
         3.1.1         Avoid Passing Stack Local Data
         3.1.2         Initialize Objects Before Thread Creation
         3.1.3         Do Not Use Scheduling As Synchronization
     3.2     Memory Synchronization Between Threads
     3.3     Sharing Memory Between Threads
         3.3.1         Using Static Memory
         3.3.2         Using Stack Memory
         3.3.3         Using Dynamic Memory
     3.4     Managing a Thread's Stack
         3.4.1         Sizing the Stack
         3.4.2         Using Stack Overflow Warning and Stack Guard Areas
         3.4.3         Diagnosing Stack Overflow Errors
     3.5     Scheduling Issues
         3.5.1         Real-Time Scheduling
         3.5.2         Priority Inversion
         3.5.3         Dependencies Among Scheduling Attributes and Contention Scope
     3.6     Using Synchronization Objects
         3.6.1         Distinguishing Proper Usage of Mutexes and Condition Variables
         3.6.2         Avoiding Race Conditions
         3.6.3         Avoiding Deadlocks
         3.6.4         Signaling a Condition Variable
         3.6.5         Static Initialization Inappropriate for Stack-Based Synchronization Objects
     3.7     Granularity Considerations
         3.7.1         Determinants of a Program's Granularity
                Alpha Processor Granularity
                VAX Processor Granularity
         3.7.2         Compiler Support for Determining the Program's Actual Granularity
         3.7.3         Word Tearing
         3.7.4         Alignments of Members of Composite Data Objects
         3.7.5         Avoiding Granularity-Related Errors
                Changing the Composite Data Object's Layout
                Maintaining the Composite Data Object's Layout
                Using One Mutex Per Composite Data Object
         3.7.6         Identifying Possible Word-Tearing Situations Using Visual Threads
     3.8     One-Time Initialization
     3.9     Managing Dependencies Upon Other Libraries
         3.9.1         Thread Reentrancy
         3.9.2         Thread Safety
         3.9.3         Lacking Thread Safety
                Using Mutex Around Call to Unsafe Code
                Using the Global Lock
                Using or Copying Static Data Before Releasing the Mutex
         3.9.4         Use of Multiple Threads Libraries Not Supported
     3.10     Detecting Error Conditions
         3.10.1         Bugcheck Information
         3.10.2         Interpreting a Bugcheck

Previous Next Contents Index