aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-14 16:32:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-14 16:32:41 +0000
commit890c5532da783e8d58cfbf28822bcedaa8a0c61d (patch)
tree617e200bc65fe60a4770f5dac26d1a42cccea48c /src
parente776216d02920673266e31d553078f4edec4a264 (diff)
downloadChibiOS-890c5532da783e8d58cfbf28822bcedaa8a0c61d.tar.gz
ChibiOS-890c5532da783e8d58cfbf28822bcedaa8a0c61d.tar.bz2
ChibiOS-890c5532da783e8d58cfbf28822bcedaa8a0c61d.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@90 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r--src/chmsg.c2
-rw-r--r--src/chschd.c24
-rw-r--r--src/include/threads.h3
3 files changed, 18 insertions, 11 deletions
diff --git a/src/chmsg.c b/src/chmsg.c
index 5ea3f9821..0f24b24aa 100644
--- a/src/chmsg.c
+++ b/src/chmsg.c
@@ -153,7 +153,7 @@ t_msg chMsgWait(void) {
* @return the pointer to the message structure. Note, it is always the
* message associated to the thread on the top of the messages queue.
* If the queue is empty then \p NULL is returned.
- * @note You can assume that the data contained in the message is stable until
+ * @note You can assume that the data pointed by the message is stable until
* you invoke \p chMsgRelease() because the sending thread is
* suspended until then. Always remember that the message data is not
* copied between the sender and the receiver, just a pointer is passed.
diff --git a/src/chschd.c b/src/chschd.c
index c88a63ead..a3763cd38 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -81,7 +81,11 @@ Thread *chSchReadyI(Thread *tp) {
* Switches to the next thread in the ready list, the ready list is assumed
* to contain at least a thread.
*/
+#ifdef CH_OPTIMIZE_SPEED
+static INLINE void nextready(void) {
+#else
static void nextready(void) {
+#endif
Thread *otp = currp;
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
@@ -111,27 +115,27 @@ void chSchGoSleepS(t_tstate newstate) {
* Wakeups a thread, the thread is inserted into the ready list or made
* running directly depending on its relative priority compared to the current
* thread.
- * @param tp the Thread to be made ready
+ * @param ntp the Thread to be made ready
* @param msg wakeup message to the awakened thread
* @note The function must be called in the system mutex zone.
* @note The function is not meant to be used in the user code directly.
* @note It is equivalent to a \p chSchReadyI() followed by a
* \p chSchRescheduleI() but much more efficient.
*/
-void chSchWakeupS(Thread *tp, t_msg msg) {
- Thread *ctp = currp;
+void chSchWakeupS(Thread *ntp, t_msg msg) {
- if (tp->p_prio <= ctp->p_prio)
- chSchReadyI(tp)->p_rdymsg = msg;
+ if (ntp->p_prio <= currp->p_prio)
+ chSchReadyI(ntp)->p_rdymsg = msg;
else {
- chSchReadyI(ctp);
- (currp = tp)->p_state = PRCURR;
- tp->p_rdymsg = msg;
+ Thread *otp = currp;
+ chSchReadyI(otp);
+ (currp = ntp)->p_state = PRCURR;
+ ntp->p_rdymsg = msg;
preempt = CH_TIME_QUANTUM;
#ifdef CH_USE_DEBUG
- chDbgTrace(ctp, tp);
+ chDbgTrace(otp, ntp);
#endif
- chSysSwitchI(&ctp->p_ctx, &tp->p_ctx);
+ chSysSwitchI(&otp->p_ctx, &ntp->p_ctx);
}
}
diff --git a/src/include/threads.h b/src/include/threads.h
index e4cd8376e..ee00039b3 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -178,6 +178,9 @@ extern "C" {
/** Returns the pointer to the \p Thread currently in execution.*/
#define chThdSelf() currp
+/** Returns the thread priority.*/
+#define chThdGetPriority() (currp->p_prio)
+
/** Returns the pointer to the \p Thread local storage area, if any.*/
#define chThdLS() (void *)(currp + 1)