diff options
Diffstat (limited to 'os/kernel')
-rw-r--r-- | os/kernel/src/chmtx.c | 6 | ||||
-rw-r--r-- | os/kernel/src/chschd.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/os/kernel/src/chmtx.c b/os/kernel/src/chmtx.c index 88b6f4ecd..93943bba0 100644 --- a/os/kernel/src/chmtx.c +++ b/os/kernel/src/chmtx.c @@ -136,7 +136,11 @@ void chMtxLockS(Mutex *mp) { break;
#endif
case THD_STATE_READY:
- /* Re-enqueues tp with its new priority on the ready list.*/
+#if CH_DBG_ENABLE_ASSERTS
+ /* Prevents an assertion in chSchReadyI().*/
+ tp->p_state = THD_STATE_CURRENT;
+#endif
+ /* Re-enqueues tp with its new priority on the ready list.*/
chSchReadyI(dequeue(tp));
}
break;
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 51987749f..c4a6a3fd0 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -72,6 +72,12 @@ Thread *chSchReadyI(Thread *tp) { #endif
Thread *cp;
+ /* Integrity check.*/
+ chDbgAssert((tp->p_state != THD_STATE_READY) &&
+ (tp->p_state != THD_STATE_FINAL),
+ "chSchReadyI(), #1",
+ "invalid state");
+
tp->p_state = THD_STATE_READY;
cp = (Thread *)&rlist.r_queue;
do {
|