add: int i; #ifdef DEBUG_TRACK_SEM Uint32 semval = SDL_SemValue (sem); if (semval != 0) { fprintf (stderr, "WARNING: trying to clear a free semaphore (value=%d)\n", semval);  return; } for (i = 0;SemList[i] != NULL; i++) if (*SemList[i] == sem) { if (! semthread[i] && semthread[i] != SDL_ThreadID ()) fprintf( stderr, "WARNING: tried to free a Semaphore held by another thread!\n"); semthread[i] = 0; break; } #endif
context: ClearSemaphore (Semaphore sem){	NativeClearSemaphore ((NativeSemaphore) sem);}