5 #define MAX_SEM_COUNT 1024 // What are the tradeoffs with this value?
9 LPCRITICAL_SECTION lock = malloc(sizeof(CRITICAL_SECTION));
10 InitializeCriticalSection(lock);
14 void naLock(void* lock) { EnterCriticalSection((LPCRITICAL_SECTION)lock); }
15 void naUnlock(void* lock) { LeaveCriticalSection((LPCRITICAL_SECTION)lock); }
16 void* naNewSem() { return CreateSemaphore(0, 0, MAX_SEM_COUNT, 0); }
17 void naSemDown(void* sem) { WaitForSingleObject((HANDLE)sem, INFINITE); }
18 void naSemUpAll(void* sem, int count) { ReleaseSemaphore(sem, count, 0); }
22 extern int GccWarningWorkaround_IsoCForbidsAnEmptySourceFile;