mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Simplify mutex wrapper into simply differentiating between RENDERTYPEWIN (which is deprecated...) and everything else, which uses SDL mutexes.
git-svn-id: https://svn.eduke32.com/eduke32@4441 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d287b50cd7
commit
a33f9c2ca1
2 changed files with 5 additions and 15 deletions
|
@ -3,11 +3,9 @@
|
||||||
|
|
||||||
/* Mutual exclusion mechanism wrappers for the different platforms */
|
/* Mutual exclusion mechanism wrappers for the different platforms */
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#ifdef RENDERTYPEWIN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
#elif !defined GEKKO
|
|
||||||
# include <pthread.h>
|
|
||||||
#else
|
#else
|
||||||
# include "sdl_inc.h"
|
# include "sdl_inc.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,10 +14,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#ifdef RENDERTYPEWIN
|
||||||
typedef HANDLE mutex_t;
|
typedef HANDLE mutex_t;
|
||||||
#elif !defined GEKKO
|
|
||||||
typedef pthread_mutex_t mutex_t;
|
|
||||||
#else
|
#else
|
||||||
/* PK: I don't like pointer typedefs, but SDL_CreateMutex() _returns_ one,
|
/* PK: I don't like pointer typedefs, but SDL_CreateMutex() _returns_ one,
|
||||||
* so we're out of luck with our interface. */
|
* so we're out of luck with our interface. */
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
|
|
||||||
int32_t mutex_init(mutex_t *mutex)
|
int32_t mutex_init(mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef RENDERTYPEWIN
|
||||||
*mutex = CreateMutex(0, FALSE, 0);
|
*mutex = CreateMutex(0, FALSE, 0);
|
||||||
return (*mutex == 0);
|
return (*mutex == 0);
|
||||||
#elif !defined GEKKO
|
|
||||||
return pthread_mutex_init(mutex, NULL);
|
|
||||||
#else
|
#else
|
||||||
if (mutex)
|
if (mutex)
|
||||||
{
|
{
|
||||||
|
@ -21,10 +19,8 @@ int32_t mutex_init(mutex_t *mutex)
|
||||||
|
|
||||||
int32_t mutex_lock(mutex_t *mutex)
|
int32_t mutex_lock(mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef RENDERTYPEWIN
|
||||||
return (WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED);
|
return (WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED);
|
||||||
#elif !defined GEKKO
|
|
||||||
return pthread_mutex_lock(mutex);
|
|
||||||
#else
|
#else
|
||||||
return SDL_LockMutex(*mutex);
|
return SDL_LockMutex(*mutex);
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,10 +28,8 @@ int32_t mutex_lock(mutex_t *mutex)
|
||||||
|
|
||||||
int32_t mutex_unlock(mutex_t *mutex)
|
int32_t mutex_unlock(mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef RENDERTYPEWIN
|
||||||
return (ReleaseMutex(*mutex) == 0);
|
return (ReleaseMutex(*mutex) == 0);
|
||||||
#elif !defined GEKKO
|
|
||||||
return pthread_mutex_unlock(mutex);
|
|
||||||
#else
|
#else
|
||||||
return SDL_UnlockMutex(*mutex);
|
return SDL_UnlockMutex(*mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue