- removed dependency on SDL

This commit is contained in:
alexey.lysiuk 2020-01-04 15:07:43 +02:00 committed by Christoph Oelckers
parent efb049a8a3
commit 2422d06835
2 changed files with 5 additions and 62 deletions

View file

@ -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 )

View file

@ -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