rem: return (Semaphore) NativeCreateSemaphore (initial);
add: Semaphore sem = (Semaphore)NativeCreateSemaphore (initial); #ifdef DEBUG_TRACK_SEM int pos; if (SemMutex == 0) SemMutex = NativeCreateSemaphore (0); else NativeSetSemaphore (SemMutex); for (pos = 0; pos < numSems; pos++) if (SemMon[pos].Sem == 0) break; if (pos == numSems) { numSems++; if (numSems == NUM_SEMAPHORES) { fprintf(stderr, "Error: We ran out of semaphores.  aborting!\n"); NativeClearSemaphore (SemMutex); return (0); } } SemMon[pos].Sem = sem; SemMon[pos].Thread = 0; strncpy(SemMon[pos].Name, sem_name, 20); SemMon[pos].Name[19] = 0; #if defined (THREAD_QUEUE) && defined (THREAD_NAMES)   #else   #endif NativeClearSemaphore (SemMutex); #endif return (sem);
context: CreateSemaphore (DWORD initial){	return (Semaphore) NativeCreateSemaphore (initial);}