mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 12:03:51 +00:00
8472718fb7
This untangles some of the gigantic kitchen sink headers in an attempt to split things into smaller files. Also don't include gl.h, glext.h, windows.h, and other such nonsense *everywhere*. Lots of cleanups on the way too. More dead/unused code removal. Remove incrFlag(), decrFlag() Lua functions.
55 lines
704 B
C++
55 lines
704 B
C++
#include "MT.h"
|
|
#include "SDL.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);
|
|
}
|
|
|