2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CMUTEX_H
|
|
|
|
#define CMUTEX_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
// recursive mutex class
|
|
|
|
class CMutex {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
// copy c'tor is equivalent to default c'tor. it's here to
|
|
|
|
// allow copying of objects that have mutexes.
|
|
|
|
CMutex();
|
|
|
|
CMutex(const CMutex&);
|
|
|
|
~CMutex();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
// this has no effect. it's only here to allow assignment of
|
2001-10-06 18:13:28 +04:00
|
|
|
// objects that have mutexes.
|
2002-04-29 18:40:01 +04:00
|
|
|
CMutex& operator=(const CMutex&);
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
2001-10-14 20:58:01 +04:00
|
|
|
void lock() const;
|
|
|
|
void unlock() const;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-06 18:13:28 +04:00
|
|
|
void init();
|
|
|
|
void fini();
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-06 18:13:28 +04:00
|
|
|
friend class CCondVarBase;
|
2002-04-29 18:40:01 +04:00
|
|
|
void* m_mutex;
|
2001-10-06 18:13:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|