2014-11-22 12:32:56 +00:00
|
|
|
#ifndef mutex_h_
|
|
|
|
#define mutex_h_
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-05-01 12:39:20 +00:00
|
|
|
/* Mutual exclusion mechanism wrappers for the different platforms */
|
|
|
|
|
2014-04-17 19:58:07 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2012-05-01 12:39:20 +00:00
|
|
|
# include <windows.h>
|
|
|
|
# include <process.h>
|
2010-05-02 23:27:30 +00:00
|
|
|
#else
|
2014-04-17 20:00:07 +00:00
|
|
|
# define SDL_MAIN_HANDLED
|
2013-10-13 09:08:31 +00:00
|
|
|
# include "sdl_inc.h"
|
2010-05-02 23:27:30 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
2012-11-05 02:49:08 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-04-17 19:58:07 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2010-05-02 23:27:30 +00:00
|
|
|
typedef HANDLE mutex_t;
|
2012-05-01 12:39:20 +00:00
|
|
|
#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;
|
2010-05-02 23:27:30 +00:00
|
|
|
#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);
|
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
2012-11-05 02:49:08 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-08-12 13:38:37 +00:00
|
|
|
#endif
|