OSStatus MD_CriticalRegionExit(MDCriticalRegionID inCriticalRegionID) { MDCriticalRegionDataPtr criticalRegion = (MDCriticalRegionDataPtr)inCriticalRegionID; MPTaskID currentTaskID = MPCurrentTaskID(); OSStatus err = noErr; // if we don't own the critical region... if (currentTaskID != criticalRegion->mMPTaskID) return kMPInsufficientResourcesErr; // if we aren't at a depth... if (criticalRegion->mDepthCount == 0) return kMPInsufficientResourcesErr; // un-bump my depth criticalRegion->mDepthCount--; // if we just bottomed out... if (criticalRegion->mDepthCount == 0) { // release ownership of the structure criticalRegion->mMPTaskID = kInvalidID; // and signal the ready semaphore err = MPSignalSemaphore(criticalRegion->mMPSemaphoreID); } return err; }
static void callback(SndChannelPtr channel, SndCommand *command) { struct buffer *buffer = (struct buffer *) command->param2; MPSignalSemaphore(buffer->semaphore); }
wxSemaError wxSemaphoreInternal::Post() { OSStatus err = MPSignalSemaphore( m_semaphore ); MPYield(); if (err != noErr) return wxSEMA_MISC_ERROR; return wxSEMA_NO_ERROR; }
wxSemaError wxSemaphoreInternal::Post() { OSStatus err = MPSignalSemaphore( m_semaphore); if ( err) { return wxSEMA_MISC_ERROR; } return wxSEMA_NO_ERROR; }
void cFUSemaphore::Up() { #if defined(WIN32) ReleaseSemaphore(semaphoreHandle, 1, nullptr); #elif defined(FP_APPLE) MPSignalSemaphore(semaphoreHandle); #elif defined(LINUX) || defined(ANDROID) || defined(IOS) sem_post(&semaphoreHandle); #endif }
void releaseWorkerThread ( WorkerThreadRef worker ) { if ( !worker ) return; if ( 1 == DecrementAtomic( &worker->referenceCount ) ) { if ( 0 != worker->numberOfActiveRequests ) { DebugStr("\preleaseWorkerThread: reference count went to zero, but there are still active requests" ); } ExitMoviesOnThread(); pthread_detach( worker->workerThread ); // ask worker thread to clean up and exit worker->shutdown = true; //POSIX sem_post( &worker->requestSemaphore ); //POSIX sem_post( &worker->shutdownSemaphore ); // avoid race condition where busy thread disposes requestSemaphore before we post to it MPSignalSemaphore(worker->requestSemaphore); MPSignalSemaphore(worker->shutdownSemaphore); // avoid race condition where busy thread disposes requestSemaphore before we post to it }
wxMutexError wxMutexInternal::Unlock() { wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ; OSStatus err = MPSignalSemaphore( m_semaphore); if ( err) { wxLogSysError(_("Could not unlock mutex")); return wxMUTEX_MISC_ERROR; } return wxMUTEX_NO_ERROR; }
void delivery_man::accept_deliveries() { if(m_bPackageWaiting) { assert(m_pPackage != NULL); m_pPackage->accept(); m_pPackage = NULL; m_bPackageWaiting = false; // signal to the thread making the call that we're done OSStatus lStatus = MPSignalSemaphore(m_pSemaphore); assert(lStatus == noErr); } }
static int flush(void) { int i, result = 0; if (soundcmd(IMMEDIATE, flushCmd, 0, 0) == -1) result = -1; for (i = 0; i < NBUFFERS; ++i) MPSignalSemaphore(output[i].semaphore); output[bindex].pcm_nsamples = 0; return result; }
void hsGlobalSemaphore::Signal() { OSStatus status = MPSignalSemaphore(fSemaId); hsThrowIfOSErr(status); }