Skip to content
Snippets Groups Projects
Commit ff6a0170 authored by rswindell's avatar rswindell
Browse files

Changed Win32 POSIX semaphore macros to actually use counting semaphores

rather than events (boolean semaphores).
parent 5cf144df
No related branches found
No related tags found
No related merge requests found
......@@ -76,11 +76,14 @@ extern "C" {
#elif defined(_WIN32)
#include <process.h> /* _beginthread */
#include <limits.h> /* INT_MAX */
/* POSIX semaphores */
typedef HANDLE sem_t;
#define sem_init(psem,ps,v) ResetEvent(*(psem))
#define sem_init(psem,ps,v) *(psem)=CreateSemaphore(NULL,v,INT_MAX,NULL)
#define sem_wait(psem) WaitForSingleObject(*(psem),INFINITE)
#define sem_post(psem) SetEvent(*(psem))
#define sem_post(psem) ReleaseSemaphore(*(psem),1,NULL)
#define sem_destroy(psem) CloseHandle(*(psem))
DLLEXPORT int DLLCALL sem_getvalue(sem_t*, int* val);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment