F4MP/f4mp_originalcode/thirdparty/zpl/code/header/threading/sem.h
Jous99 37b16f1547 code upload
codigo original de f4mp y tilted para referencias
2026-01-06 18:45:00 +01:00

31 lines
908 B
C

// file: header/threading/sem.h
#ifdef ZPL_EDITOR
#include <zpl.h>
#endif
ZPL_BEGIN_C_DECLS
#if defined(ZPL_SYSTEM_MACOS)
#include <mach/thread_act.h>
#elif defined(ZPL_SYSTEM_UNIX)
#include <semaphore.h>
#endif
#if defined(ZPL_SYSTEM_WINDOWS)
typedef struct zpl_semaphore { void *win32_handle; } zpl_semaphore;
#elif defined(ZPL_SYSTEM_MACOS)
typedef struct zpl_semaphore { semaphore_t osx_handle; } zpl_semaphore;
#elif defined(ZPL_SYSTEM_UNIX)
typedef struct zpl_semaphore { sem_t unix_handle; } zpl_semaphore;
#else
#error
#endif
ZPL_DEF void zpl_semaphore_init (zpl_semaphore *s);
ZPL_DEF void zpl_semaphore_destroy(zpl_semaphore *s);
ZPL_DEF void zpl_semaphore_post (zpl_semaphore *s, zpl_i32 count);
ZPL_DEF void zpl_semaphore_release(zpl_semaphore *s); // NOTE: zpl_semaphore_post(s, 1)
ZPL_DEF void zpl_semaphore_wait (zpl_semaphore *s);
ZPL_END_C_DECLS