//+---------------------------------------------------------------------------- // // File: semaphore.h // // Module: // // Synopsis: // // Author: sgasch // // Created 8 Jun 1999 // //+---------------------------------------------------------------------------- #ifndef _LOCK #define _LOCK class CCriticalSection { public: CCriticalSection(void); CCriticalSection(int iNumThreads); ~CCriticalSection(void); bool GetNumberConcurrentThreads(int *piAnswer); bool SetNumberConcurrentThreads(int iNumber); bool TryToEnter(void); bool Enter(void); bool Leave(void); private: bool CreateSemaphore(void); bool RemoveSemaphore(void); int m_hSem; bool m_fInitialized; }; #endif // _LOCK