23 #if (defined PLATFORM_WINDOWS && !defined USE_PTW32_SEMAPHORE)
24 #define WINDOWS_SEMAPHORE 1
27 #ifdef WINDOWS_SEMAPHORE
29 #elif defined USE_FUTEX_SEMAPHORE
33 # include <semaphore.h>
42 #ifdef WINDOWS_SEMAPHORE
47 sem_t* ptr_to_sem()
const {
return _sem; }
48 #elif defined USE_FUTEX_SEMAPHORE
50 std::atomic<int> _value;
60 #if defined WINDOWS_SEMAPHORE || defined USE_FUTEX_SEMAPHORE
67 int signal () {
return sem_post (ptr_to_sem()); }
68 int wait () {
return sem_wait (ptr_to_sem()); }
69 int reset () {
int rv = 0 ;
while (sem_trywait (ptr_to_sem()) == 0) ++rv;
return rv; }
sem_t * ptr_to_sem() const
Semaphore(const char *name, int val)
GtkImageIconNameData name