Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Mutex.h

00001 /***************************************************/
00012 /***************************************************/
00013 
00014 #ifndef STK_MUTEX_H
00015 #define STK_MUTEX_H
00016 
00017 #include "Stk.h"
00018 
00019 #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
00020 
00021   #include <pthread.h>
00022   typedef pthread_mutex_t MUTEX;
00023   typedef pthread_cond_t CONDITION;
00024 
00025 #elif defined(__OS_WINDOWS__)
00026 
00027   #include <windows.h>
00028   #include <process.h>
00029   typedef CRITICAL_SECTION MUTEX;
00030   typedef HANDLE CONDITION;
00031 
00032 #endif
00033 
00034 class Mutex : public Stk
00035 {
00036  public:
00038   Mutex();
00039 
00041   ~Mutex();
00042 
00044   void lock(void);
00045 
00047   void unlock(void);
00048 
00050 
00054   void wait(void);
00055 
00057 
00061   void signal(void);
00062 
00063  protected:
00064 
00065   MUTEX mutex_;
00066   CONDITION condition_;
00067 
00068 };
00069 
00070 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.