Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Mutex.h
1 #ifndef STK_MUTEX_H
2 #define STK_MUTEX_H
3 
4 #include "Stk.h"
5 
6 #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
7 
8  #include <pthread.h>
9  typedef pthread_mutex_t MUTEX;
10  typedef pthread_cond_t CONDITION;
11 
12 #elif defined(__OS_WINDOWS__)
13 
14  #include <windows.h>
15  #include <process.h>
16  typedef CRITICAL_SECTION MUTEX;
17  typedef HANDLE CONDITION;
18 
19 #endif
20 
21 namespace stk {
22 
23 /***************************************************/
34 /***************************************************/
35 
36 class Mutex : public Stk
37 {
38  public:
40  Mutex();
41 
43  ~Mutex();
44 
46  void lock(void);
47 
49  void unlock(void);
50 
52 
56  void wait(void);
57 
59 
63  void signal(void);
64 
65  protected:
66 
67  MUTEX mutex_;
68  CONDITION condition_;
69 
70 };
71 
72 } // stk namespace
73 
74 #endif

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