Fix issues with os_eventq code calling os_sched_wakeup when the task was already woken up. We now clear the evq task after we have woken the task in os_eventq_put2.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/30e9b334 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/30e9b334 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/30e9b334 Branch: refs/heads/master Commit: 30e9b3346d5a9f361a8894d0461c353615532013 Parents: 4fd25c4 Author: wes3 <w...@micosa.io> Authored: Tue Dec 1 12:45:32 2015 -0800 Committer: wes3 <w...@micosa.io> Committed: Tue Dec 1 12:47:48 2015 -0800 ---------------------------------------------------------------------- libs/os/src/os_eventq.c | 1 + libs/os/src/os_sched.c | 2 ++ 2 files changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/30e9b334/libs/os/src/os_eventq.c ---------------------------------------------------------------------- diff --git a/libs/os/src/os_eventq.c b/libs/os/src/os_eventq.c index 3515a22..ca729db 100644 --- a/libs/os/src/os_eventq.c +++ b/libs/os/src/os_eventq.c @@ -48,6 +48,7 @@ os_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr) resched = 0; if (evq->evq_task) { os_sched_wakeup(evq->evq_task); + evq->evq_task = NULL; resched = 1; } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/30e9b334/libs/os/src/os_sched.c ---------------------------------------------------------------------- diff --git a/libs/os/src/os_sched.c b/libs/os/src/os_sched.c index 944f0f6..f287c6b 100644 --- a/libs/os/src/os_sched.c +++ b/libs/os/src/os_sched.c @@ -243,6 +243,8 @@ os_sched_sleep(struct os_task *t, os_time_t nticks) int os_sched_wakeup(struct os_task *t) { + assert(t->t_state == OS_TASK_SLEEP); + /* Remove self from mutex list if waiting on one */ if (t->t_mutex) { assert(!SLIST_EMPTY(&t->t_mutex->mu_head));