sthread - #ifndef_STHREAD_H#define_STHREAD_H Note this...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#ifndef _STHREAD_H_ #define _STHREAD_H_ /* Note: this library requires you to link with the posix threads library (-lpthread) and the real time library (-lrt) {for nanosleep}. c++ -D_POSIX_PTHREAD_SEMANTICS main.cc sthread.cc -lpthread -lrt or g++ -Wall -D_POSIX_PTHREAD_SEMANTICS main.cc sthread.cc -lpthread -lrt */ #include <pthread.h> #include <unistd.h> /* * The normal random() library may not be thread safe * so we add a wrapper with locks. */ long sutil_random(void); void sutil_srandom(unsigned seed); /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* * Mutexes. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* // Create a mutex with
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/05/2010.

Page1 / 3

sthread - #ifndef_STHREAD_H#define_STHREAD_H Note this...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online