aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/rt/src/chsem.c8
-rw-r--r--readme.txt2
2 files changed, 6 insertions, 4 deletions
diff --git a/os/rt/src/chsem.c b/os/rt/src/chsem.c
index 2b89884ab..90df0dd73 100644
--- a/os/rt/src/chsem.c
+++ b/os/rt/src/chsem.c
@@ -294,11 +294,11 @@ msg_t chSemWaitTimeoutS(semaphore_t *sp, systime_t time) {
void chSemSignal(semaphore_t *sp) {
chDbgCheck(sp != NULL);
+
+ chSysLock();
chDbgAssert(((sp->cnt >= (cnt_t)0) && queue_isempty(&sp->queue)) ||
((sp->cnt < (cnt_t)0) && queue_notempty(&sp->queue)),
"inconsistent semaphore");
-
- chSysLock();
if (++sp->cnt <= (cnt_t)0) {
chSchWakeupS(queue_fifo_remove(&sp->queue), MSG_OK);
}
@@ -379,14 +379,14 @@ msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
msg_t msg;
chDbgCheck((sps != NULL) && (spw != NULL));
+
+ chSysLock();
chDbgAssert(((sps->cnt >= (cnt_t)0) && queue_isempty(&sps->queue)) ||
((sps->cnt < (cnt_t)0) && queue_notempty(&sps->queue)),
"inconsistent semaphore");
chDbgAssert(((spw->cnt >= (cnt_t)0) && queue_isempty(&spw->queue)) ||
((spw->cnt < (cnt_t)0) && queue_notempty(&spw->queue)),
"inconsistent semaphore");
-
- chSysLock();
if (++sps->cnt <= (cnt_t)0) {
chSchReadyI(queue_fifo_remove(&sps->queue))->u.rdymsg = MSG_OK;
}
diff --git a/readme.txt b/readme.txt
index 519a315ec..64891650e 100644
--- a/readme.txt
+++ b/readme.txt
@@ -89,6 +89,8 @@
*****************************************************************************
*** Next ***
+- RT: Fixed misplaced assertion in semaphores code (bug #865)(backported to
+ 17.6.1 and 16.1.9).
- HAL: Fixed STM32 USBv1 fails the state check when USB_USE_WAIT is TRUE
(bug #863)(backported to 17.6.1 and 16.1.9).
- HAL: Fixed incorrect OTG stepping in STM32F412 registry (bug #861)