You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1014 B
52 lines
1014 B
#ifndef _CSEM_H
|
|
#define _CSEM_H
|
|
/*****************************************************************************\
|
|
* Class CriticalSection - Header file
|
|
*
|
|
* Copyright (C) 1998 Microsoft Corporation
|
|
*
|
|
* History:
|
|
* Jun 10, 1998, Weihai Chen (weihaic)
|
|
*
|
|
\*****************************************************************************/
|
|
|
|
class CCriticalSection
|
|
{
|
|
public:
|
|
CCriticalSection (void);
|
|
|
|
virtual
|
|
~CCriticalSection (void);
|
|
|
|
inline BOOL
|
|
bValid () CONST { return m_bValid;};
|
|
|
|
BOOL
|
|
Lock (void) const;
|
|
|
|
BOOL
|
|
Unlock (void) const;
|
|
|
|
private:
|
|
CRITICAL_SECTION m_csec;
|
|
BOOL m_bValid;
|
|
};
|
|
|
|
typedef class CCriticalSection TCriticalSection;
|
|
|
|
class TAutoCriticalSection
|
|
{
|
|
public:
|
|
TAutoCriticalSection (
|
|
CONST TCriticalSection & refCrit);
|
|
|
|
~TAutoCriticalSection (VOID);
|
|
|
|
BOOL bValid (VOID);
|
|
|
|
private:
|
|
BOOL m_bValid;
|
|
const TCriticalSection &m_pCritSec;
|
|
};
|
|
|
|
#endif
|