static THD_FUNCTION(thread10, p) { chMtxLock(&m1); chCondWait(&c1); test_emit_token(*(char *)p); chMtxUnlock(&m1); }
static msg_t thread10(void *p) { chMtxLock(&m1); chCondWait(&c1); test_emit_token(*(char *)p); chMtxUnlock(); return 0; }
/** * @brief Waits for a condvar signal. * @details Waits until the condvar is signalled. * @note This procedure must be called within a lock zone guarded by a * mutex, shared by the waiting and the signalling thread. * * @param[in,out] cvp * Pointer to an initialized @p UrosCondVar object. * @param[in,out] mtxp * Pointer to the mutex guarding this condvar. */ void uros_lld_condvar_wait(UrosCondVar *cvp, UrosMutex *mtxp) { urosAssert(cvp != NULL); #if UROS_THREADING_C_USE_ASSERT != UROS_FALSE chSysLock(); urosAssert(mtxp == currp->p_mtxlist); chSysUnlock(); #endif (void)mtxp; chCondWait(cvp); }
static THD_FUNCTION(thread11, p) { chMtxLock(&m2); chMtxLock(&m1); #if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) chCondWaitTimeout(&c1, TIME_INFINITE); #else chCondWait(&c1); #endif test_emit_token(*(char *)p); chMtxUnlock(&m1); chMtxUnlock(&m2); }
static msg_t thread11(void *p) { chMtxLock(&m2); chMtxLock(&m1); #if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) chCondWaitTimeout(&c1, TIME_INFINITE); #else chCondWait(&c1); #endif test_emit_token(*(char *)p); chMtxUnlock(); chMtxUnlock(); return 0; }
msg_t CondVar::wait(void) { return chCondWait(&condvar); }