2012-04-02 08:56:30 +02:00
|
|
|
#ifndef MUTEX_H
|
|
|
|
#define MUTEX_H
|
2012-03-31 09:09:40 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
class I2_BASE_API Mutex
|
2012-03-31 09:09:40 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
#ifdef _WIN32
|
|
|
|
CRITICAL_SECTION m_Mutex;
|
|
|
|
#else /* _WIN32 */
|
|
|
|
pthread_mutex_t m_Mutex;
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
public:
|
2012-04-16 08:36:50 +02:00
|
|
|
Mutex(void);
|
|
|
|
~Mutex(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
bool TryEnter(void);
|
|
|
|
void Enter(void);
|
|
|
|
void Exit(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2012-04-16 08:36:50 +02:00
|
|
|
CRITICAL_SECTION *Get(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
#else /* _WIN32 */
|
2012-04-16 08:36:50 +02:00
|
|
|
pthread_mutex_t *Get(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* MUTEX_H */
|