Installing pthreads library on linux:
sudo apt-get install libpthread-stubs0-dev
You can compile threaded programms with gnu compiler with the following command:
gcc -pthread file.c
gcc -pthread file.c -o thread -lpthread
-lpthread command will tell the compiler to execute the program with pthread.h library.
gcc is the compiler command.
file.c is the name of c program source file.
-o is option to make object file.
thread is the name of object file.
All identifiers in the threads library begin with pthread_.
Some frequently used methods are:
1) pthread_ = Threads themselves and miscellaneous subroutines
2) pthread_attr_ = Thread attributes objects
3) pthread_mutex_ = Mutexes
4) pthread_mutexattr_ = Mutex attributes objects.
Also the pthread.h header file should be included in each source file using the Pthreads library.