Chapter 11  -  POSIX Threads.


thread1.c  -  a program to test for thread support. To compile this program, you may need to use the command:
cc -D_POSIX_C_SOURCE=199506L thread1.c -o thread1

When thread1.c is run, it produces the output, "POSIX version is set to" followed by an integer.  If this integer
is less than 199506, then you may not be able to compile some or all of the following programs.

To compile the following programs, you may need to use the command:
cc -D_REENTRANT threadX.c -o threadX -lpthread

thread2.c  -  a simple program using threads.

thread3.c  -  a program that executes 2 threads simultaneously.  You may have to wait a few seconds before
this program produces output.

thread4.c  -  a program that synchronizes threads using seamphores.

thread4a.c  -  a modified version of thread4.c.

thread5.c  -  a program that synchronizes threads using mutexes.

thread6.c  -  a program that sets a thread's detached state attribute.

If the output from thread1.c is less than 199506, then the following programs are particularly likely not to
compile.

thread7.c, thread7a.c  -  two programs that set a thread's scheduling attribute.

thread8.c  -  a program that cancels a thread.

thread9.c, thread9a.c  -  two programs that create many threads.