squall/storm/thread/SCritSect.hpp

25 lines
474 B
C++
Raw Normal View History

2020-09-09 00:45:46 -05:00
#ifndef STORM_THREAD_S_CRIT_SECT_HPP
#define STORM_THREAD_S_CRIT_SECT_HPP
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
2020-09-09 00:45:46 -05:00
#include <pthread.h>
#endif
class SCritSect {
public:
// Member variables
#if defined(WHOA_PLATFORM_WIN)
2020-09-09 00:45:46 -05:00
CRITICAL_SECTION m_opaqueData;
#endif
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
2020-09-09 00:45:46 -05:00
pthread_mutex_t m_mutex;
#endif
// Member functions
void Enter(void);
void Leave(void);
};
#endif