Merge pull request #16374 from seeseemelk/master
xtimer: Fix race condition in xtimer_msg_receive_timeout
This commit is contained in:
commit
2229e95a3b
@ -135,12 +135,12 @@ static void _setup_timer_msg(msg_t *m, xtimer_t *t)
|
|||||||
static int _msg_wait(msg_t *m, msg_t *tmsg, xtimer_t *t)
|
static int _msg_wait(msg_t *m, msg_t *tmsg, xtimer_t *t)
|
||||||
{
|
{
|
||||||
msg_receive(m);
|
msg_receive(m);
|
||||||
|
xtimer_remove(t);
|
||||||
if (m->type == MSG_XTIMER && m->content.ptr == tmsg) {
|
if (m->type == MSG_XTIMER && m->content.ptr == tmsg) {
|
||||||
/* we hit the timeout */
|
/* we hit the timeout */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xtimer_remove(t);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user