diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-03 14:54:05 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-03 14:54:05 +0000 |
commit | 903575815458e4e3c12195418f0582f5a9350f81 (patch) | |
tree | 08c7b5d907a8e1539a4e2f28d903e14b9c3d75ca /src/chsem.c | |
parent | 2467527dd5297ac4f9619184608b60a550cb86dc (diff) | |
download | ChibiOS-903575815458e4e3c12195418f0582f5a9350f81.tar.gz ChibiOS-903575815458e4e3c12195418f0582f5a9350f81.tar.bz2 ChibiOS-903575815458e4e3c12195418f0582f5a9350f81.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@124 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chsem.c')
-rw-r--r-- | src/chsem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/chsem.c b/src/chsem.c index 01ec80649..083e25412 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -33,6 +33,7 @@ */
void chSemInit(Semaphore *sp, t_cnt n) {
+ chDbgAssert(n >= 0, "chsem.c, chSemInit()");
fifo_init(&sp->s_queue);
sp->s_cnt = n;
}
@@ -48,6 +49,7 @@ void chSemInit(Semaphore *sp, t_cnt n) { void chSemReset(Semaphore *sp, t_cnt n) {
t_cnt cnt;
+ chDbgAssert(n >= 0, "chsem.c, chSemReset()");
chSysLock();
cnt = sp->s_cnt;
@@ -73,6 +75,7 @@ void chSemReset(Semaphore *sp, t_cnt n) { void chSemResetI(Semaphore *sp, t_cnt n) {
t_cnt cnt;
+ chDbgAssert(n >= 0, "chsem.c, chSemResetI()");
cnt = sp->s_cnt;
sp->s_cnt = n;
while (cnt++ < 0)
@@ -116,10 +119,7 @@ t_msg chSemWaitS(Semaphore *sp) { #ifdef CH_USE_SEMAPHORES_TIMEOUT
static void wakeup(void *p) {
-#ifdef CH_USE_DEBUG
- if (((Thread *)p)->p_state != PRWTSEM)
- chDbgPanic("chsem.c, wakeup()");
-#endif
+ chDbgAssert(((Thread *)p)->p_state == PRWTSEM, "chsem.c, wakeup()");
chSemFastSignalI(((Thread *)p)->p_semp);
chSchReadyI(dequeue(p), RDY_TIMEOUT);
}
|