Pthread Samples

Each sample program can be compiled and run independent to the other code. To make an executable out of a source code, write your own Makefile, or:
g++ -o first first.cc -lposix4 -lpthread
first.cc: A simple program that creates two identical threads. Each thread reads a shared variable balance and add $1000 to it.
second.cc: Allows a thread t

read more | digg story

Advertisements

%d bloggers like this: