void LockLeave(void* Handle) { lock_t *lock = (lock_t *)Handle; if (lock && --lock->Counter == 0) { lock->Thread = 0; RMutex p; p.SetHandle(lock->Handle); p.Signal(); } }
/* Unlock the mutex */ int SDL_mutexV(SDL_mutex *mutex) { if ( mutex == NULL ) { SDL_SetError("Passed a NULL mutex"); return -1; } RMutex rmutex; rmutex.SetHandle(mutex->handle); rmutex.Signal(); return(0); }
void LockDelete(void* Handle) { lock_t *lock = (lock_t *)Handle; if (lock) { RMutex p; p.SetHandle(lock->Handle); p.Close(); free(lock); } }
/* Free the mutex */ void SDL_DestroyMutex(SDL_mutex *mutex) { if ( mutex ) { RMutex rmutex; rmutex.SetHandle(mutex->handle); rmutex.Signal(); rmutex.Close(); delete(mutex); mutex = NULL; } }
bool_t ConditionWait(void* Handle,int Tick,void* Lock) { RCondVar p; RMutex m; p.SetHandle((int)Handle); m.SetHandle((int)Lock); // Increase the tick by one to mimic other platforms // which is -1 = Wait forever, 0 = Return // For Symbian, 0 = Wait forever Tick++; return p.TimedWait(m, Tick*1000) == KErrNone; }
/* Free the mutex */ void SDL_DestroyMutex(SDL_mutex *mutex) { if ( mutex ) { RMutex rmutex; rmutex.SetHandle(mutex->handle); if(rmutex.IsHeld()) { rmutex.Signal(); } rmutex.Close(); EpocSdlEnv::RemoveCleanupItem(mutex); delete(mutex); mutex = NULL; } }
void LockEnter(void* Handle) { lock_t *lock = (lock_t *)Handle; if (lock) { RThread current; TUint currentId = current.Id(); if (lock->Thread == currentId) ++lock->Counter; else { RMutex p; p.SetHandle(lock->Handle); p.Wait(); assert(lock->Counter==0); lock->Counter = 1; lock->Thread = currentId; } } }
void LockLeave(void* Handle) { RMutex p; p.SetHandle((int)Handle); p.Signal(); }
void LockEnter(void* Handle) { RMutex p; p.SetHandle((int)Handle); p.Wait(); }
void LockDelete(void* Handle) { RMutex p; p.SetHandle((int)Handle); p.Close(); }