mirror of
https://github.com/ZDoom/ZMusic.git
synced 2024-11-24 04:41:35 +00:00
- removed dependency on SDL
This commit is contained in:
parent
efb049a8a3
commit
2422d06835
2 changed files with 5 additions and 62 deletions
|
@ -10,6 +10,10 @@ endif()
|
||||||
|
|
||||||
include( CheckFunctionExists )
|
include( CheckFunctionExists )
|
||||||
|
|
||||||
|
if( NOT WIN32 AND NOT APPLE )
|
||||||
|
find_package( Threads )
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package( ALSA )
|
find_package( ALSA )
|
||||||
if (WIN32 OR ALSA_FOUND)
|
if (WIN32 OR ALSA_FOUND)
|
||||||
add_definitions( -DHAVE_SYSTEM_MIDI )
|
add_definitions( -DHAVE_SYSTEM_MIDI )
|
||||||
|
|
|
@ -91,7 +91,7 @@ void LeaveCriticalSection(FInternalCriticalSection *c)
|
||||||
c->Leave();
|
c->Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __APPLE__
|
#else
|
||||||
|
|
||||||
#include "critsec.h"
|
#include "critsec.h"
|
||||||
|
|
||||||
|
@ -160,65 +160,4 @@ void LeaveCriticalSection(FInternalCriticalSection *c)
|
||||||
c->Leave();
|
c->Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include "SDL.h"
|
|
||||||
#include "SDL_thread.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
|
|
||||||
class FInternalCriticalSection
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FInternalCriticalSection()
|
|
||||||
{
|
|
||||||
CritSec = SDL_CreateMutex();
|
|
||||||
if (CritSec == NULL)
|
|
||||||
{
|
|
||||||
I_FatalError("Failed to create a critical section mutex.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
~FInternalCriticalSection()
|
|
||||||
{
|
|
||||||
if (CritSec != NULL)
|
|
||||||
{
|
|
||||||
SDL_DestroyMutex(CritSec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Enter()
|
|
||||||
{
|
|
||||||
if (SDL_mutexP(CritSec) != 0)
|
|
||||||
{
|
|
||||||
I_FatalError("Failed entering a critical section.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Leave()
|
|
||||||
{
|
|
||||||
if (SDL_mutexV(CritSec) != 0)
|
|
||||||
{
|
|
||||||
I_FatalError("Failed to leave a critical section.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
SDL_mutex *CritSec;
|
|
||||||
};
|
|
||||||
|
|
||||||
FInternalCriticalSection *CreateCriticalSection()
|
|
||||||
{
|
|
||||||
return new FInternalCriticalSection();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeleteCriticalSection(FInternalCriticalSection *c)
|
|
||||||
{
|
|
||||||
delete c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnterCriticalSection(FInternalCriticalSection *c)
|
|
||||||
{
|
|
||||||
c->Enter();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LeaveCriticalSection(FInternalCriticalSection *c)
|
|
||||||
{
|
|
||||||
c->Leave();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue