raze-gles/polymer/eduke32/build/include/mutex.h
hendricks266 fcf9beae6a Work-in-progress adjustment to the C code to compile under C++. It builds for me without errors using Win32 MinGW-GCC, but it still generates warning soup. No guarantees about MSVC or anything using SDL. Enable C++ by building with CPLUSPLUS=1. C remains the default and should compile with no change in setup.
Credit to Plagman for the idea and doing the work on the game side, which is included in this commit.

(Building as C++ will give us features with which we can make improvements and optimizations on the multiplayer code and Polymer.)

git-svn-id: https://svn.eduke32.com/eduke32@3116 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 02:49:08 +00:00

38 lines
718 B
C

#ifndef __mutex_h__
#define __mutex_h__
/* Mutual exclusion mechanism wrappers for the different platforms */
#if defined(_WIN32)
# include <windows.h>
# include <process.h>
#elif !defined GEKKO
# include <pthread.h>
#else
# include <SDL.h>
#endif
#ifdef EXTERNC
extern "C" {
#endif
#if defined(_WIN32)
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. */
typedef SDL_mutex* mutex_t;
#endif
extern int32_t mutex_init(mutex_t *mutex);
extern int32_t mutex_lock(mutex_t *mutex);
extern int32_t mutex_unlock(mutex_t *mutex);
#ifdef EXTERNC
}
#endif
#endif