Beispiel #1
0
/**
 * This destructor unlocks the semaphore.
 */
Synchronized::~Synchronized()
{
	if (m_mutex != NULL) {
		giveMutex(m_mutex);
	} else {
		giveSemaphore(m_semaphore);
	}
}
Beispiel #2
0
/**
 * @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;
}
Beispiel #3
0
	/**
	 * Unlock the semaphore.
	 * @return 0 for success, -1 for error. If -1, the error will be in errno.
	 */
	int give()
	{
		return giveMutex(m_semaphore);
	}