[riot-notifications] [RIOT-OS/RIOT] core: `msg_receive()` sometimes returns without `msg` being re-set (#10881)

Martine Lenders notifications at github.com
Mon Jan 28 15:11:55 CET 2019


`sched_run` is not called for some run :-/

```diff
diff --git a/core/msg.c b/core/msg.c
index a46875f..55823ed 100644
--- a/core/msg.c
+++ b/core/msg.c
@@ -327,9 +327,12 @@ static int _msg_receive(msg_t *m, int block)
             sched_set_status(me, STATUS_RECEIVE_BLOCKED);
 
             irq_restore(state);
+            puts("1");
             thread_yield_higher();
+            puts("2");
 
             /* sender copied message */
+            assert(sched_active_thread->status != STATUS_RECEIVE_BLOCKED);
         }
         else {
             irq_restore(state);
diff --git a/core/sched.c b/core/sched.c
index d78f1e0..4d63ddc 100644
--- a/core/sched.c
+++ b/core/sched.c
@@ -91,7 +91,7 @@ int __attribute__((used)) sched_run(void)
     int nextrq = bitarithm_lsb(runqueue_bitcache);
     thread_t *next_thread = container_of(sched_runqueues[nextrq].next->next, thread_t, rq_entry);
 
-    DEBUG("sched_run: active thread: %" PRIkernel_pid ", next thread: %" PRIkernel_pid "\n",
+    printf("sched_run: active thread: %" PRIkernel_pid ", next thread: %" PRIkernel_pid "\n",
           (kernel_pid_t)((active_thread == NULL) ? KERNEL_PID_UNDEF : active_thread->pid),
           next_thread->pid);
```

```
1
sched_run: active thread: 6, next thread: 4
sched_run: active thread: 4, next thread: 6
2
sched_run: active thread: 6, next thread: 4
sched_run: active thread: 4, next thread: 6
1
2
core/msg.c:335 => 0x8049e12
*** RIOT kernel panic:
FAILED ASSERTION.
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/10881#issuecomment-458146028
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190128/eaacc9a5/attachment.html>


More information about the notifications mailing list