예제 #1
0
파일: th_log.c 프로젝트: davepmo/miniecu
void log_init(void)
{
	chThdCreateStatic(wa_log, sizeof(wa_log), LOG_PRIO, th_log, NULL);

	chMtxLock(&m_init_mtx);
	chCondWaitTimeout(&m_log_init_done, INIT_TIMEOUT);
	chMtxUnlock(&m_init_mtx);
}
예제 #2
0
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);
}
예제 #3
0
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;
}
예제 #4
0
bool mcucom_port_condvar_wait(mcucom_port_cond_t *cond, mcucom_port_mutex_t *mutex, uint32_t timeout_us)
{
    (void)mutex;

    if (timeout_us == MCUCOM_PORT_TIMEOUT_IMMEDIATE) {
        return false;
    }
    systime_t timeout;
    if (timeout_us == MCUCOM_PORT_TIMEOUT_NEVER) {
        timeout = TIME_INFINITE;
    } else {
        timeout = US2ST(timeout_us);
    }
    msg_t ret = chCondWaitTimeout(cond, timeout);
    if (ret == MSG_TIMEOUT) {
        chMtxLock(mutex);
        return false;
    } else {
        return true;
    }
}
예제 #5
0
파일: ch.cpp 프로젝트: viktorradnai/ChibiOS
msg_t CondVar::waitTimeout(systime_t time) {

    return chCondWaitTimeout(&condvar, time);
}