// #define _POSIX_C_SOURCE 199506L #include #include using std::cout; pthread_mutex_t mutex_; pthread_mutex_t* mutex; int threadNum; extern "C" {typedef void*(*cprog)(void*);} void * program (void *v) { int status; int number; // Decide a thread number -- there may be a better way than this! status = pthread_mutex_lock(mutex); if (status) cout << "pthread_mutex_lock for threadNum returned " <