chore(fmod): add files from Chensne/DragonNest
This commit is contained in:
commit
50fb3c6b1c
544 changed files with 315778 additions and 0 deletions
55
src/fmod_localcriticalsection.h
Executable file
55
src/fmod_localcriticalsection.h
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef _FMOD_LOCALCRITICALSECTION_H
|
||||
#define _FMOD_LOCALCRITICALSECTION_H
|
||||
|
||||
#include "fmod_settings.h"
|
||||
#include "fmod_os_misc.h"
|
||||
|
||||
namespace FMOD
|
||||
{
|
||||
class LocalCriticalSection
|
||||
{
|
||||
private:
|
||||
|
||||
FMOD_OS_CRITICALSECTION *mCrit;
|
||||
bool mEntered;
|
||||
|
||||
public:
|
||||
|
||||
LocalCriticalSection()
|
||||
{
|
||||
mEntered = false;
|
||||
}
|
||||
LocalCriticalSection(FMOD_OS_CRITICALSECTION *crit, bool enternow = false)
|
||||
{
|
||||
mEntered = false;
|
||||
mCrit = crit;
|
||||
|
||||
if (enternow)
|
||||
{
|
||||
enter();
|
||||
}
|
||||
}
|
||||
~LocalCriticalSection()
|
||||
{
|
||||
if (mEntered)
|
||||
{
|
||||
leave();
|
||||
}
|
||||
}
|
||||
|
||||
void enter()
|
||||
{
|
||||
FMOD_OS_CriticalSection_Enter(mCrit);
|
||||
mEntered = true;
|
||||
}
|
||||
void leave()
|
||||
{
|
||||
FMOD_OS_CriticalSection_Leave(mCrit);
|
||||
mEntered = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue