wxMutexError wxMutexInternal::TryLock() { const wxMutexError rc = LockTimeout(0); // we have a special return code for timeout in this case return rc == wxMUTEX_TIMEOUT ? wxMUTEX_BUSY : rc; }
DeleteReports DeleteCallbackI::loop(int loops, long ms) { int count = 0; RIntPtr errors; while (!errors && count < loops) { errors = block(ms); count++; } if (!errors) { int waited = (ms/1000) * loops; stringstream ss; ss << "Delete unfinished after " << waited << "seconds."; throw LockTimeout("", "", ss.str(), 5000L, waited); } else { return handle->report(); } };
void Mutex::lock() { #if defined(_WIN32) || defined(_XBOX) #if USE_CRITICAL_SECTION if ( m_pMutex != NULL ) EnterCriticalSection( (CRITICAL_SECTION *)m_pMutex ); #else if ( m_pMutex != NULL && WaitForSingleObject( (HANDLE)m_pMutex, MAX_LOCK_TIME ) != WAIT_OBJECT_0 ) throw LockTimeout(); #endif #else if ( m_pMutex != NULL ) pthread_mutex_lock( &((PTMutex *)m_pMutex)->m_Mutex ); #endif }
omero::cmd::ResponsePtr CmdCallbackI::loop(int loops, long ms) { int count = 0; bool found = false; while (count < loops) { count++; found = block(ms); if (found) { break; } } if (found) { return getResponse(); } else { int waited = (ms/1000.0) * loops; stringstream ss; ss << "Cmd unfinished after " << waited << "seconds."; throw LockTimeout("", "", ss.str(), 5000L, waited); } };
wxMutexError Lock(unsigned long ms) { return LockTimeout(ms); }
wxMutexError Lock() { return LockTimeout(INFINITE); }
wxMutexError TryLock() { return LockTimeout(0); }
wxMutexError Lock() { return LockTimeout(SEM_INDEFINITE_WAIT); }
wxMutexError TryLock() { return LockTimeout(SEM_IMMEDIATE_RETURN); }