/** * This destructor unlocks the semaphore. */ Synchronized::~Synchronized() { if (m_mutex != NULL) { giveMutex(m_mutex); } else { giveSemaphore(m_semaphore); } }
/** * @param timeout Not implemented. */ int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout) { takeMutex(m); int8_t val = pthread_cond_wait(sem, m); giveMutex(m); return val; }
/** * Unlock the semaphore. * @return 0 for success, -1 for error. If -1, the error will be in errno. */ int give() { return giveMutex(m_semaphore); }