00001
00002 #ifndef MutexH
00003 #define MutexH
00004
00005 #if defined(_WINNT) || defined(_Windows) //-------------------------------------------
00006
00007 #include <windows.h>
00008 #include <stdlib.h>
00009
00010 #elif defined(_SOLARIS) //-------------------------------------------
00011
00012 #include <synch.h>
00013
00014 #else //-------------------------------------------
00015
00016 #endif //-------------------------------------------
00017
00018 #include <worm_exceptions.h>
00019
00020
00021 #define WORM_MUTEX_NAME_LEN 14
00022 typedef char MUTEX_NAME[WORM_MUTEX_NAME_LEN+1];
00023
00024 class TMutex
00025 {
00026 private:
00027 #if defined(_WINNT) || defined(_Windows)
00028 HANDLE MutexHandle;
00029 #elif defined(_SOLARIS)
00030
00031
00032 mutex_t MutexHandle;
00033 #else
00034 #error TMutex not complete in mutex.h for this OS
00035 #endif
00036 protected:
00037 MUTEX_NAME Name;
00038 public:
00039
00040
00041 TMutex( const MUTEX_NAME p_name );
00042
00043 ~TMutex();
00044
00045
00046 void RequestLock();
00047
00048
00049 void ReleaseLock();
00050 };
00051
00052 #endif
00053