- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# CCriticalSectionScope.hpp

Go to the documentation of this file.

    00001 #ifndef __CCriticalSectionScope__
    00002 #define __CCriticalSectionScope__
    00003
    00004 #include "CCriticalSection.hpp"
    00005 using Exponent::Threading::CCriticalSection;
    00006
    00007 //  ===========================================================================
    00008
    00009 namespace Exponent
    00010 {
    00011     namespace Threading
    00012     {
    00047         class CCriticalSectionScope
    00048         {
    00049         public:
    00050
    00055             CCriticalSectionScope(CCriticalSection &criticalSection);
    00056
    00061             CCriticalSectionScope(CCriticalSection *criticalSection = NULL);
    00062
    00068             CCriticalSectionScope(CCriticalSection &criticalSection, const long waitTimeInMilliseconds);
    00069
    00075             CCriticalSectionScope(CCriticalSection *criticalSection, const long waitTimeInMilliseconds);
    00076
    00080             ~CCriticalSectionScope();
    00081
    00082 //  ===========================================================================
    00083
    00088             void setAndEnterCriticalSection(CCriticalSection *criticalSection);
    00089
    00096             bool setAndTryToEnterCriticalSection(CCriticalSection *criticalSection, const long waitTimeInMilliseconds);
    00097
    00101             void endCriticalSection();
    00102
    00103 //  ===========================================================================
    00104
    00109             bool hasEntered() const { return m_entered; }
    00110
    00111 //  ===========================================================================
    00112
    00113         protected:
    00114
    00115 //  ===========================================================================
    00116
    00117             bool m_entered;
    00118             CCriticalSection *m_criticalSection;
    00119         };
    00120     }
    00121 }
    00122
    00123
    00124 #endif  // End of CCriticalSectionScope.hpp