00001 #if !defined(__MCSEMAPHORE_H_)
00002 #define __MCSEMAPHORE_H_
00003
00004 #ident "@(#)$Id: MCSemaphore.h,v 1.3 2004/12/02 07:05:20 mike Exp $"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "mcllib/MCNonCopy.h"
00026 #include "mcllib/MCMutex.h"
00027 #include "mcllib/MCWaitNotify.h"
00028 #include "mcllib/MCTypes.h"
00029
00030 namespace mcllib
00031 {
00038 class MCSemaphore : public MCMutex, public MCWaitNotify, public MCNonCopy
00039 {
00040 public:
00049 MCSemaphore(const char* name);
00062 MCSemaphore(const char* name, mcintn mode,
00063 mcintn initialValue = 0, bool excl = false);
00072 ~MCSemaphore();
00078 void post();
00089 static void remove(const char* name);
00090
00097 virtual void lock();
00103 virtual void unlock();
00104
00109 virtual void wait();
00114 virtual void notify();
00115 private:
00116 void* m_impl;
00117 };
00118 };
00119
00120 #endif