diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-07-22 09:53:49 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-07-22 09:53:49 +0000 |
commit | b263680b98fbb41e939ce62e55916254ece4acc7 (patch) | |
tree | 955478a7805979b9cd35e0e3c8663dcc66fb0ff8 /os/rt | |
parent | b693c748d55f60e5380e26efac95d31a46f1c169 (diff) | |
download | ChibiOS-b263680b98fbb41e939ce62e55916254ece4acc7.tar.gz ChibiOS-b263680b98fbb41e939ce62e55916254ece4acc7.tar.bz2 ChibiOS-b263680b98fbb41e939ce62e55916254ece4acc7.zip |
Fixed bug #865.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10336 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/src/chsem.c | 8 |
1 files changed, 4 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;
}
|