Examples: Threads
These examples are used throughout this topic.
Use the following as examples for your programs:
Note:
By using the code examples, you agree to the terms of the
Code license and disclaimer information
.
Pthread examples:
Java™ examples:
Example: Set a thread attribute in a Pthread program
Example: Start a thread in a Pthread program
Example: End a thread in a Pthread program
Example: Cancel a thread in a Pthread program
Example: Wait for threads in a Pthread program
Example: Use mutexes in Pthread programs
Example: Use semaphores in Pthread programs to protect shared data
Example: Use condition variables in Pthread programs
Example: Space location locks in Pthread programs
Example: One-time initialization in Pthread programs
Example: Thread-specific data in Pthread programs
Example: Sample flight recorder output from a Pthread program
Example: Work with local SQL databases in multithreaded Pthread programs
Example: Set a thread attribute in Java
Example: Start a thread using Java
Example: End a thread using Java
Example: Cancel a thread using Java
Example: Suspend a thread using Java
Example: Wait for threads using Java
Example: Use mutexes in Java
Example: Use condition variables in Java programs
Example: Thread-specific data in Java programs
Parent topic:
Multithreaded applications
Related reference
Threads considerations for Java language