mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 17:53:47 +00:00
276265be1d
The following options have been applied globally, using unifdef(1): ```c #undef BBGE_BUILD_DIRECTX #define BBGE_BUILD_OPENGL 1 #define GL_GLEXT_LEGACY 1 #define HAVE_PUTENV 1 #define TIXML_USE_STL 1 #define BBGE_BUILD_SDL 1 ```
55 lines
705 B
C++
55 lines
705 B
C++
#include "MT.h"
|
|
#include "Base.h"
|
|
|
|
|
|
// --------- Lockable ----------
|
|
|
|
Lockable::Lockable()
|
|
: _mtx(NULL)
|
|
{
|
|
_mtx = SDL_CreateMutex();
|
|
}
|
|
|
|
Lockable::~Lockable()
|
|
{
|
|
SDL_DestroyMutex((SDL_mutex*)_mtx);
|
|
}
|
|
|
|
void Lockable::lock()
|
|
{
|
|
SDL_LockMutex((SDL_mutex*)_mtx);
|
|
}
|
|
|
|
void Lockable::unlock()
|
|
{
|
|
SDL_UnlockMutex((SDL_mutex*)_mtx);
|
|
}
|
|
|
|
// --------- Waitable ----------
|
|
|
|
Waitable::Waitable()
|
|
: _cond(NULL)
|
|
{
|
|
_cond = SDL_CreateCond();
|
|
}
|
|
|
|
Waitable::~Waitable()
|
|
{
|
|
SDL_DestroyCond((SDL_cond*)_cond);
|
|
}
|
|
|
|
void Waitable::wait()
|
|
{
|
|
SDL_CondWait((SDL_cond*)_cond, (SDL_mutex*)mutex());
|
|
}
|
|
|
|
void Waitable::signal()
|
|
{
|
|
SDL_CondSignal((SDL_cond*)_cond);
|
|
}
|
|
|
|
void Waitable::broadcast()
|
|
{
|
|
SDL_CondBroadcast((SDL_cond*)_cond);
|
|
}
|
|
|