From a33f9c2ca1a6edc92c4543bc871ae7fc08c7277f Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 17 Apr 2014 19:58:07 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/mutex.h | 8 ++------ polymer/eduke32/build/src/mutex.c | 12 +++--------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/polymer/eduke32/build/include/mutex.h b/polymer/eduke32/build/include/mutex.h index 4582eef91..987a141bd 100644 --- a/polymer/eduke32/build/include/mutex.h +++ b/polymer/eduke32/build/include/mutex.h @@ -3,11 +3,9 @@ /* Mutual exclusion mechanism wrappers for the different platforms */ -#if defined(_WIN32) +#ifdef RENDERTYPEWIN # include # include -#elif !defined GEKKO -# include #else # include "sdl_inc.h" #endif @@ -16,10 +14,8 @@ extern "C" { #endif -#if defined(_WIN32) +#ifdef RENDERTYPEWIN typedef HANDLE mutex_t; -#elif !defined GEKKO -typedef pthread_mutex_t mutex_t; #else /* PK: I don't like pointer typedefs, but SDL_CreateMutex() _returns_ one, * so we're out of luck with our interface. */ diff --git a/polymer/eduke32/build/src/mutex.c b/polymer/eduke32/build/src/mutex.c index 6be0e323b..9d6e4ed6f 100644 --- a/polymer/eduke32/build/src/mutex.c +++ b/polymer/eduke32/build/src/mutex.c @@ -3,11 +3,9 @@ int32_t mutex_init(mutex_t *mutex) { -#ifdef _WIN32 +#ifdef RENDERTYPEWIN *mutex = CreateMutex(0, FALSE, 0); return (*mutex == 0); -#elif !defined GEKKO - return pthread_mutex_init(mutex, NULL); #else if (mutex) { @@ -21,10 +19,8 @@ int32_t mutex_init(mutex_t *mutex) int32_t mutex_lock(mutex_t *mutex) { -#ifdef _WIN32 +#ifdef RENDERTYPEWIN return (WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED); -#elif !defined GEKKO - return pthread_mutex_lock(mutex); #else return SDL_LockMutex(*mutex); #endif @@ -32,10 +28,8 @@ int32_t mutex_lock(mutex_t *mutex) int32_t mutex_unlock(mutex_t *mutex) { -#ifdef _WIN32 +#ifdef RENDERTYPEWIN return (ReleaseMutex(*mutex) == 0); -#elif !defined GEKKO - return pthread_mutex_unlock(mutex); #else return SDL_UnlockMutex(*mutex); #endif