aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsleep.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-23 13:53:53 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-23 13:53:53 +0000
commitf2ced068fb80aa38326e1ef75eafdd5834e9017a (patch)
tree20d9ae80ab056ee26917d836c0c5c7f3371f66b8 /src/chsleep.c
parentf851339621a3179ded94f8a27b30c9345896ccc5 (diff)
downloadChibiOS-f2ced068fb80aa38326e1ef75eafdd5834e9017a.tar.gz
ChibiOS-f2ced068fb80aa38326e1ef75eafdd5834e9017a.tar.bz2
ChibiOS-f2ced068fb80aa38326e1ef75eafdd5834e9017a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@107 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chsleep.c')
-rw-r--r--src/chsleep.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/chsleep.c b/src/chsleep.c
index e8703ab1a..ae6e394b8 100644
--- a/src/chsleep.c
+++ b/src/chsleep.c
@@ -25,6 +25,15 @@
#include <ch.h>
#ifdef CH_USE_SLEEP
+static void wakeup(void *p) {
+
+#ifdef CH_USE_DEBUG
+ if (((Thread *)p)->p_state != PRSLEEP)
+ chDbgPanic("chsleep.c, wakeup()\r\n");
+#endif
+ chSchReadyI(p, RDY_OK);
+}
+
/**
* Suspends the invoking thread for the specified time.
* @param time the system ticks number
@@ -34,7 +43,7 @@ void chThdSleep(t_time time) {
chSysLock();
- chVTSetI(&vt, time, (t_vtfunc)chSchReadyI, currp);
+ chVTSetI(&vt, time, wakeup, currp);
chSchGoSleepS(PRSLEEP);
chSysUnlock();
@@ -53,7 +62,7 @@ void chThdSleepUntil(t_time time) {
chSysLock();
- chVTSetI(&vt, (t_time)(time - stime), (t_vtfunc)chSchReadyI, currp);
+ chVTSetI(&vt, (t_time)(time - rlist.r_stime), wakeup, currp);
chSchGoSleepS(PRSLEEP);
chSysUnlock();