mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(thread): add thread functions
This commit is contained in:
parent
d0487caba3
commit
266bdc7737
16 changed files with 523 additions and 0 deletions
21
storm/thread/SCritSect.cpp
Normal file
21
storm/thread/SCritSect.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "thread/SCritSect.hpp"
|
||||
|
||||
void SCritSect::Enter() {
|
||||
#if defined(PLATFORM_WIN)
|
||||
EnterCriticalSection(&this->m_opaqueData);
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
|
||||
pthread_mutex_lock(&this->m_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SCritSect::Leave() {
|
||||
#if defined(PLATFORM_WIN)
|
||||
LeaveCriticalSection(&this->m_opaqueData);
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
|
||||
pthread_mutex_unlock(&this->m_mutex);
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue