00001 /******************************************************************** 00002 Copyright (c) 2001, Lee Patterson & Ant Works Software 00003 http://ssobjects.sourceforge.net 00004 00005 Original source from Win32 Multithreaded Programming 00006 Copyright (c) 1997 by Aaron Michael Cohen and Mike Woodring 00007 00008 filename : mclcritsec.cpp 00009 author : Lee Patterson (lee@antws.com) 00010 00011 purpose : Supplies functionality found in MclThread win32 libs. Not all 00012 functionality has been brought across. The critical section 00013 is impliemented as a mutex as Linux doesn't have a kernel 00014 CRITICAL section. This is to maintain compatibility with 00015 existing code. 00016 *********************************************************************/ 00017 00018 #ifndef __CMCLCRITSEC_H__ 00019 #define __CMCLCRITSEC_H__ 00020 00021 //#include "msdefs.h" 00022 # include <pthread.h> 00023 00024 namespace ssobjects 00025 { 00026 00027 class CMclCritSec 00028 { 00029 public: 00030 // constructor creates a CRITICAL_SECTION inside 00031 // the C++ object... 00032 CMclCritSec(); 00033 00034 // destructor... 00035 virtual ~CMclCritSec(); 00036 00037 // enter the critical section... 00038 void Enter(void); 00039 00040 // leave the critical section... 00041 void Leave(void); 00042 00043 private: 00044 pthread_mutex_t m_mutexCritSec; 00045 }; 00046 00047 }; 00048 00049 #endif 00050