コード例 #1
0
ファイル: chsem.c プロジェクト: Amirelecom/brush-v1
/**
 * @brief   Performs a wait operation on a semaphore.
 *
 * @param[in] sp        pointer to a @p Semaphore structure
 * @return              A message specifying how the invoking thread has been
 *                      released from the semaphore.
 * @retval RDY_OK       if the thread has not stopped on the semaphore or the
 *                      semaphore has been signaled.
 * @retval RDY_RESET    if the semaphore has been reset using @p chSemReset().
 *
 * @api
 */
msg_t chSemWait(Semaphore *sp) {
  msg_t msg;

  chSysLock();
  msg = chSemWaitS(sp);
  chSysUnlock();
  return msg;
}
コード例 #2
0
ファイル: ili9341.c プロジェクト: 1847123212/ebike-controller
/**
 * @brief   Gains exclusive access to the ILI9341 module.
 * @details This function tries to gain ownership to the ILI9341 module, if the
 *          module is already being used then the invoking thread is queued.
 * @pre     In order to use this function the option
 *          @p ILI9341_USE_MUTUAL_EXCLUSION must be enabled.
 * @pre     ILI9341 is ready.
 *
 * @param[in] driverp   pointer to the @p ILI9341Driver object
 *
 * @sclass
 */
void ili9341AcquireBusS(ILI9341Driver *driverp) {

  osalDbgCheckClassS();
  osalDbgCheck(driverp == &ILI9341D1);
  osalDbgAssert(driverp->state == ILI9341_READY, "not ready");

#if (TRUE == CH_CFG_USE_MUTEXES)
  chMtxLockS(&driverp->lock);
#else
  chSemWaitS(&driverp->lock);
#endif
}
コード例 #3
0
ファイル: ch.cpp プロジェクト: viktorradnai/ChibiOS
msg_t CounterSemaphore::waitS(void) {

    return chSemWaitS(&sem);
}
コード例 #4
0
inline
void Semaphore_::wait_unsafe() {

  chSemWaitS(&impl);
}