我想设置一个计时器并检查它是否在下一次调用函数时过期coap_send_transaction()
。我怎样才能做到这一点?
PROCESS_THREAD(example_process, ev, data){
static struct etimer et;
PROCESS_BEGIN();
while (1) {
etimer_set(&et, CLOCK_SECOND); /* Set the timer to 1 second. */
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
printf("the timer is expired!\n");
}
PROCESS_END();
}
void coap_send_transaction(coap_transaction_t *t) {
process_start(&example_process, NULL);
if etimer_expired(&et) {
// do something
// how can I do this?
}
}