2017-12-12 22:12:07 +08:00
|
|
|
#ifndef LOCKUTIL_H
|
|
|
|
#define LOCKUTIL_H
|
|
|
|
|
2019-06-07 22:54:31 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-12-16 00:31:23 +08:00
|
|
|
// forward declarations
|
|
|
|
typedef struct SDL_mutex SDL_mutex;
|
|
|
|
typedef struct SDL_cond SDL_cond;
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
|
|
|
mutex_lock(SDL_mutex *mutex);
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_unlock(SDL_mutex *mutex);
|
|
|
|
|
|
|
|
void
|
|
|
|
cond_wait(SDL_cond *cond, SDL_mutex *mutex);
|
|
|
|
|
2019-06-07 22:54:31 +08:00
|
|
|
// return 0 or SDL_MUTEX_TIMEDOUT
|
|
|
|
int
|
|
|
|
cond_wait_timeout(SDL_cond *cond, SDL_mutex *mutex, uint32_t ms);
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
|
|
|
cond_signal(SDL_cond *cond);
|
2017-12-15 23:38:14 +08:00
|
|
|
|
2017-12-12 22:12:07 +08:00
|
|
|
#endif
|