example codes for POSIX pthreads