aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src/chsem.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-06-02 11:17:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-06-02 11:17:33 +0000
commit4ee79187645d1a2687f81de3f19320acbce733c8 (patch)
tree08cd2209833aa2982220a6320b63bd950ccf6dc5 /os/kernel/src/chsem.c
parentbf019ef89dcbb31160f8c7dd4a4a2dc3f2ee1a22 (diff)
downloadChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.tar.gz
ChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.tar.bz2
ChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1982 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src/chsem.c')
-rw-r--r--os/kernel/src/chsem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c
index 2a86a14f6..2959b4d63 100644
--- a/os/kernel/src/chsem.c
+++ b/os/kernel/src/chsem.c
@@ -117,7 +117,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
cnt = sp->s_cnt;
sp->s_cnt = n;
- while (cnt++ < 0)
+ while (++cnt <= 0)
chSchReadyI(lifo_remove(&sp->s_queue))->p_u.rdymsg = RDY_RESET;
}
@@ -220,7 +220,7 @@ void chSemSignal(Semaphore *sp) {
chDbgCheck(sp != NULL, "chSemSignal");
chSysLock();
- if (sp->s_cnt++ < 0)
+ if (++sp->s_cnt <= 0)
chSchWakeupS(fifo_remove(&sp->s_queue), RDY_OK);
chSysUnlock();
}
@@ -235,7 +235,7 @@ void chSemSignalI(Semaphore *sp) {
chDbgCheck(sp != NULL, "chSemSignalI");
- if (sp->s_cnt++ < 0) {
+ if (++sp->s_cnt <= 0) {
/* note, it is done this way in order to allow a tail call on
chSchReadyI().*/
Thread *tp = fifo_remove(&sp->s_queue);
@@ -261,7 +261,7 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
chDbgCheck((sps != NULL) && (spw != NULL), "chSemSignalWait");
chSysLock();
- if (sps->s_cnt++ < 0)
+ if (++sps->s_cnt <= 0)
chSchReadyI(fifo_remove(&sps->s_queue))->p_u.rdymsg = RDY_OK;
if (--spw->s_cnt < 0) {
Thread *ctp = currp;