aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-20 14:39:34 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-20 14:39:34 +0000
commit7bd8164f8ff6ffd0a9458d44e18097582adae201 (patch)
tree9ef74756d9e59459d68294ed32c6d951364d7947 /os/kernel/src
parentca013cf8e4235a3024361009f21eb1a2d5677acf (diff)
downloadChibiOS-7bd8164f8ff6ffd0a9458d44e18097582adae201.tar.gz
ChibiOS-7bd8164f8ff6ffd0a9458d44e18097582adae201.tar.bz2
ChibiOS-7bd8164f8ff6ffd0a9458d44e18097582adae201.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1532 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src')
-rw-r--r--os/kernel/src/chcond.c36
-rw-r--r--os/kernel/src/chevents.c32
-rw-r--r--os/kernel/src/chmsg.c10
-rw-r--r--os/kernel/src/chmtx.c24
-rw-r--r--os/kernel/src/chschd.c26
-rw-r--r--os/kernel/src/chsem.c22
-rw-r--r--os/kernel/src/chsys.c2
-rw-r--r--os/kernel/src/chthreads.c32
8 files changed, 93 insertions, 91 deletions
diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c
index 39b5fd1fc..a7ba23ed5 100644
--- a/os/kernel/src/chcond.c
+++ b/os/kernel/src/chcond.c
@@ -72,7 +72,7 @@ void chCondSignalI(CondVar *cp) {
chDbgCheck(cp != NULL, "chCondSignalI");
if (notempty(&cp->c_queue)) /* any thread ? */
- chSchReadyI(fifo_remove(&cp->c_queue))->p_rdymsg = RDY_OK;
+ chSchReadyI(fifo_remove(&cp->c_queue))->p_u.rdymsg = RDY_OK;
}
/**
@@ -97,11 +97,11 @@ void chCondBroadcastI(CondVar *cp) {
chDbgCheck(cp != NULL, "chCondBroadcastI");
- /* empties the condition variable queue and inserts all the Threads into the
+ /* Empties the condition variable queue and inserts all the Threads into the
* ready list in FIFO order. The wakeup message is set to @p RDY_RESET in
- * order to make a chCondBroadcast() detectable from a chCondSignal(). */
+ * order to make a chCondBroadcast() detectable from a chCondSignal().*/
while (cp->c_queue.p_next != (void *)&cp->c_queue)
- chSchReadyI(fifo_remove(&cp->c_queue))->p_rdymsg = RDY_RESET;
+ chSchReadyI(fifo_remove(&cp->c_queue))->p_u.rdymsg = RDY_RESET;
}
/**
@@ -146,13 +146,13 @@ msg_t chCondWaitS(CondVar *cp) {
"chCondWaitS(), #1",
"not owning a mutex");
- mp = chMtxUnlockS(); /* unlocks the condvar mutex */
- prio_insert(currp, &cp->c_queue); /* enters the condvar queue */
- currp->p_wtcondp = cp; /* needed by the tracer */
- chSchGoSleepS(PRWTCOND); /* waits on the condvar */
- msg = currp->p_rdymsg; /* fetches the wakeup message */
- chMtxLockS(mp); /* atomically relocks the mutex */
- return msg; /* returns the wakeup message */
+ mp = chMtxUnlockS();
+ prio_insert(currp, &cp->c_queue);
+ currp->p_u.wtobjp = cp;
+ chSchGoSleepS(THD_STATE_WTCOND);
+ msg = currp->p_u.rdymsg;
+ chMtxLockS(mp);
+ return msg;
}
#if CH_USE_CONDVARS_TIMEOUT
@@ -212,13 +212,13 @@ msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) {
"chCondWaitTimeoutS(), #1",
"not owning a mutex");
- mp = chMtxUnlockS(); /* unlocks the condvar mutex */
- prio_insert(currp, &cp->c_queue); /* enters the condvar queue */
- currp->p_wtcondp = cp; /* needed by the tracer */
- chSchGoSleepTimeoutS(PRWTCOND, time); /* waits on the condvar */
- msg = currp->p_rdymsg; /* fetches the wakeup message */
- chMtxLockS(mp); /* atomically relocks the mutex */
- return msg; /* returns the wakeup message */
+ mp = chMtxUnlockS();
+ prio_insert(currp, &cp->c_queue);
+ currp->p_u.wtobjp = cp;
+ chSchGoSleepTimeoutS(THD_STATE_WTCOND, time);
+ msg = currp->p_u.rdymsg;
+ chMtxLockS(mp);
+ return msg;
}
#endif /* CH_USE_CONDVARS_TIMEOUT */
diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c
index 64636da66..580b0aea9 100644
--- a/os/kernel/src/chevents.c
+++ b/os/kernel/src/chevents.c
@@ -137,9 +137,11 @@ void chEvtSignalI(Thread *tp, eventmask_t mask) {
tp->p_epending |= mask;
/* Test on the AND/OR conditions wait states.*/
- if (((tp->p_state == PRWTOREVT) && ((tp->p_epending & tp->p_ewmask) != 0)) ||
- ((tp->p_state == PRWTANDEVT) && ((tp->p_epending & tp->p_ewmask) == tp->p_ewmask)))
- chSchReadyI(tp)->p_rdymsg = RDY_OK;
+ if (((tp->p_state == THD_STATE_WTOREVT) &&
+ ((tp->p_epending & tp->p_u.ewmask) != 0)) ||
+ ((tp->p_state == THD_STATE_WTANDEVT) &&
+ ((tp->p_epending & tp->p_u.ewmask) == tp->p_u.ewmask)))
+ chSchReadyI(tp)->p_u.rdymsg = RDY_OK;
}
/**
@@ -220,8 +222,8 @@ eventmask_t chEvtWaitOne(eventmask_t ewmask) {
chSysLock();
if ((m = (currp->p_epending & ewmask)) == 0) {
- currp->p_ewmask = ewmask;
- chSchGoSleepS(PRWTOREVT);
+ currp->p_u.ewmask = ewmask;
+ chSchGoSleepS(THD_STATE_WTOREVT);
m = currp->p_epending & ewmask;
}
m &= -m;
@@ -246,8 +248,8 @@ eventmask_t chEvtWaitAny(eventmask_t ewmask) {
chSysLock();
if ((m = (currp->p_epending & ewmask)) == 0) {
- currp->p_ewmask = ewmask;
- chSchGoSleepS(PRWTOREVT);
+ currp->p_u.ewmask = ewmask;
+ chSchGoSleepS(THD_STATE_WTOREVT);
m = currp->p_epending & ewmask;
}
currp->p_epending &= ~m;
@@ -269,8 +271,8 @@ eventmask_t chEvtWaitAll(eventmask_t ewmask) {
chSysLock();
if ((currp->p_epending & ewmask) != ewmask) {
- currp->p_ewmask = ewmask;
- chSchGoSleepS(PRWTANDEVT);
+ currp->p_u.ewmask = ewmask;
+ chSchGoSleepS(THD_STATE_WTANDEVT);
}
currp->p_epending &= ~ewmask;
@@ -308,8 +310,8 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t ewmask, systime_t time) {
if ((m = (currp->p_epending & ewmask)) == 0) {
if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
- currp->p_ewmask = ewmask;
- if (chSchGoSleepTimeoutS(PRWTOREVT, time) < RDY_OK)
+ currp->p_u.ewmask = ewmask;
+ if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK)
return (eventmask_t)0;
m = currp->p_epending & ewmask;
}
@@ -344,8 +346,8 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t ewmask, systime_t time) {
if ((m = (currp->p_epending & ewmask)) == 0) {
if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
- currp->p_ewmask = ewmask;
- if (chSchGoSleepTimeoutS(PRWTOREVT, time) < RDY_OK)
+ currp->p_u.ewmask = ewmask;
+ if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK)
return (eventmask_t)0;
m = currp->p_epending & ewmask;
}
@@ -376,8 +378,8 @@ eventmask_t chEvtWaitAllTimeout(eventmask_t ewmask, systime_t time) {
if ((currp->p_epending & ewmask) != ewmask) {
if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
- currp->p_ewmask = ewmask;
- if (chSchGoSleepTimeoutS(PRWTANDEVT, time) < RDY_OK)
+ currp->p_u.ewmask = ewmask;
+ if (chSchGoSleepTimeoutS(THD_STATE_WTANDEVT, time) < RDY_OK)
return (eventmask_t)0;
}
currp->p_epending &= ~ewmask;
diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c
index e3c82ec5a..577e82693 100644
--- a/os/kernel/src/chmsg.c
+++ b/os/kernel/src/chmsg.c
@@ -50,11 +50,11 @@ msg_t chMsgSend(Thread *tp, msg_t msg) {
chSysLock();
msg_insert(currp, &tp->p_msgqueue);
currp->p_msg = msg;
- currp->p_wtthdp = tp;
- if (tp->p_state == PRWTMSG)
+ currp->p_u.wtobjp = tp;
+ if (tp->p_state == THD_STATE_WTMSG)
chSchReadyI(tp);
- chSchGoSleepS(PRSNDMSG);
- msg = currp->p_rdymsg;
+ chSchGoSleepS(THD_STATE_SNDMSG);
+ msg = currp->p_u.rdymsg;
chSysUnlock();
return msg;
}
@@ -73,7 +73,7 @@ msg_t chMsgWait(void) {
chSysLock();
if (!chMsgIsPendingI(currp))
- chSchGoSleepS(PRWTMSG);
+ chSchGoSleepS(THD_STATE_WTMSG);
msg = chMsgGetI(currp);
chSysUnlock();
return msg;
diff --git a/os/kernel/src/chmtx.c b/os/kernel/src/chmtx.c
index 21ec5b997..962356db8 100644
--- a/os/kernel/src/chmtx.c
+++ b/os/kernel/src/chmtx.c
@@ -86,31 +86,31 @@ void chMtxLockS(Mutex *mp) {
* The following states need priority queues reordering.
*/
switch (tp->p_state) {
- case PRWTMTX:
+ case THD_STATE_WTMTX:
/* Re-enqueues tp with its new priority on the mutex wait queue.*/
- prio_insert(dequeue(tp), &tp->p_wtmtxp->m_queue);
+ prio_insert(dequeue(tp), (ThreadsQueue *)&tp->p_u.wtobjp);
/* Boost the owner of this mutex if needed.*/
- tp = tp->p_wtmtxp->m_owner;
+ tp = ((Mutex *)tp->p_u.wtobjp)->m_owner;
continue;
#if CH_USE_CONDVARS
- case PRWTCOND:
+ case THD_STATE_WTCOND:
/* Re-enqueues tp with its new priority on the condvar queue.*/
- prio_insert(dequeue(tp), &tp->p_wtcondp->c_queue);
+ prio_insert(dequeue(tp), (ThreadsQueue *)&tp->p_u.wtobjp);
break;
#endif
#if CH_USE_SEMAPHORES_PRIORITY
- case PRWTSEM:
+ case THD_STATE_WTSEM:
/* Re-enqueues tp with its new priority on the semaphore queue.*/
- prio_insert(dequeue(tp), &tp->p_wtsemp->s_queue);
+ prio_insert(dequeue(tp), (ThreadsQueue *)&tp->p_u.wtobjp);
break;
#endif
#if CH_USE_MESSAGES_PRIORITY
- case PRSNDMSG:
+ case THD_STATE_SNDMSG:
/* Re-enqueues tp with its new priority on the server thread queue.*/
- prio_insert(dequeue(tp), &tp->p_wtthdp->p_msgqueue);
+ prio_insert(dequeue(tp), ((Thread *)tp->p_u.wtobjp)->p_msgqueue);
break;
#endif
- case PRREADY:
+ case THD_STATE_READY:
/* Re-enqueues tp with its new priority on the ready list.*/
chSchReadyI(dequeue(tp));
}
@@ -118,8 +118,8 @@ void chMtxLockS(Mutex *mp) {
}
/* Sleep on the mutex.*/
prio_insert(currp, &mp->m_queue);
- currp->p_wtmtxp = mp;
- chSchGoSleepS(PRWTMTX);
+ currp->p_u.wtobjp = mp;
+ chSchGoSleepS(THD_STATE_WTMTX);
chDbgAssert(mp->m_owner == NULL, "chMtxLockS(), #1", "still owned");
}
/*
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c
index 15f7a1a16..f7be9c6a8 100644
--- a/os/kernel/src/chschd.c
+++ b/os/kernel/src/chschd.c
@@ -60,7 +60,7 @@ Thread *chSchReadyI(Thread *tp) {
#endif
Thread *cp;
- tp->p_state = PRREADY;
+ tp->p_state = THD_STATE_READY;
cp = (Thread *)&rlist.r_queue;
do {
cp = cp->p_next;
@@ -82,7 +82,7 @@ void chSchGoSleepS(tstate_t newstate) {
Thread *otp;
(otp = currp)->p_state = newstate;
- (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
+ (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT;
#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
@@ -99,21 +99,21 @@ static void wakeup(void *p) {
#if CH_USE_SEMAPHORES || CH_USE_MUTEXES || CH_USE_CONDVARS
switch (tp->p_state) {
#if CH_USE_SEMAPHORES
- case PRWTSEM:
- chSemFastSignalI(tp->p_wtsemp);
+ case THD_STATE_WTSEM:
+ chSemFastSignalI((Semaphore *)tp->p_u.wtobjp);
/* Falls into, intentional. */
#endif
#if CH_USE_MUTEXES
- case PRWTMTX:
+ case THD_STATE_WTMTX:
#endif
#if CH_USE_CONDVARS
- case PRWTCOND:
+ case THD_STATE_WTCOND:
#endif
/* States requiring dequeuing.*/
dequeue(tp);
}
#endif
- chSchReadyI(tp)->p_rdymsg = RDY_TIMEOUT;
+ chSchReadyI(tp)->p_u.rdymsg = RDY_TIMEOUT;
}
/**
@@ -149,7 +149,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
}
else
chSchGoSleepS(newstate);
- return currp->p_rdymsg;
+ return currp->p_u.rdymsg;
}
/**
@@ -166,7 +166,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
*/
void chSchWakeupS(Thread *ntp, msg_t msg) {
- ntp->p_rdymsg = msg;
+ ntp->p_u.rdymsg = msg;
/* If the waken thread has a not-greater priority than the current
* one then it is just inserted in the ready list else it made
* running immediately and the invoking thread goes in the ready
@@ -179,7 +179,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
- (currp = ntp)->p_state = PRCURR;
+ (currp = ntp)->p_state = THD_STATE_CURRENT;
chDbgTrace(otp, ntp);
chSysSwitchI(otp, ntp);
}
@@ -195,7 +195,7 @@ void chSchDoRescheduleI(void) {
Thread *otp = currp;
/* Pick the first thread from the ready queue and makes it current.*/
- (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
+ (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT;
chSchReadyI(otp);
#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
@@ -258,7 +258,7 @@ void chSchDoYieldS(void) {
* ready list there is at least one thread with priority equal or higher
* than the current one.
*/
- otp->p_state = PRREADY;
+ otp->p_state = THD_STATE_READY;
do {
cp = cp->p_prev;
} while (cp->p_prio < otp->p_prio);
@@ -267,7 +267,7 @@ void chSchDoYieldS(void) {
otp->p_next->p_prev = cp->p_next = otp;
/* Pick the first thread from the ready queue and makes it current.*/
- (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
+ (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT;
#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c
index dba765da9..c78d52f74 100644
--- a/os/kernel/src/chsem.c
+++ b/os/kernel/src/chsem.c
@@ -86,7 +86,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
cnt = sp->s_cnt;
sp->s_cnt = n;
while (cnt++ < 0)
- chSchReadyI(lifo_remove(&sp->s_queue))->p_rdymsg = RDY_RESET;
+ chSchReadyI(lifo_remove(&sp->s_queue))->p_u.rdymsg = RDY_RESET;
}
/**
@@ -120,9 +120,9 @@ msg_t chSemWaitS(Semaphore *sp) {
if (--sp->s_cnt < 0) {
sem_insert(currp, &sp->s_queue);
- currp->p_wtsemp = sp;
- chSchGoSleepS(PRWTSEM);
- return currp->p_rdymsg;
+ currp->p_u.wtobjp = sp;
+ chSchGoSleepS(THD_STATE_WTSEM);
+ return currp->p_u.rdymsg;
}
return RDY_OK;
}
@@ -174,8 +174,8 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
return RDY_TIMEOUT;
}
sem_insert(currp, &sp->s_queue);
- currp->p_wtsemp = sp;
- return chSchGoSleepTimeoutS(PRWTSEM, time);
+ currp->p_u.wtobjp = sp;
+ return chSchGoSleepTimeoutS(THD_STATE_WTSEM, time);
}
return RDY_OK;
}
@@ -213,7 +213,7 @@ void chSemSignalI(Semaphore *sp) {
/* NOTE: It is done this way in order to allow a tail call on
chSchReadyI().*/
Thread *tp = fifo_remove(&sp->s_queue);
- tp->p_rdymsg = RDY_OK;
+ tp->p_u.rdymsg = RDY_OK;
chSchReadyI(tp);
}
}
@@ -236,12 +236,12 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
chSysLock();
if (sps->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sps->s_queue))->p_rdymsg = RDY_OK;
+ chSchReadyI(fifo_remove(&sps->s_queue))->p_u.rdymsg = RDY_OK;
if (--spw->s_cnt < 0) {
sem_insert(currp, &spw->s_queue);
- currp->p_wtsemp = spw;
- chSchGoSleepS(PRWTSEM);
- msg = currp->p_rdymsg;
+ currp->p_u.wtobjp = spw;
+ chSchGoSleepS(THD_STATE_WTSEM);
+ msg = currp->p_u.rdymsg;
}
else {
chSchRescheduleS();
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index 74ee794a3..2863f253c 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -75,7 +75,7 @@ void chSysInit(void) {
/*
* Now this instructions flow becomes the main thread.
*/
- (currp = init_thread(&mainthread, NORMALPRIO))->p_state = PRCURR;
+ (currp = init_thread(&mainthread, NORMALPRIO))->p_state = THD_STATE_CURRENT;
chSysEnable();
/*
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index 6755b0b48..e372a6e5c 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -31,9 +31,9 @@
*/
Thread *init_thread(Thread *tp, tprio_t prio) {
- tp->p_flags = P_MEM_MODE_STATIC;
+ tp->p_flags = THD_MEM_MODE_STATIC;
tp->p_prio = prio;
- tp->p_state = PRSUSPENDED;
+ tp->p_state = THD_STATE_SUSPENDED;
#if CH_USE_NESTED_LOCKS
tp->p_locks = 0;
#endif
@@ -69,7 +69,7 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
/**
* @brief Initializes a new thread.
* @details The new thread is initialized but not inserted in the ready list,
- * the initial state is @p PRSUSPENDED.
+ * the initial state is @p THD_STATE_SUSPENDED.
*
* @param[out] wsp pointer to a working area dedicated to the thread stack
* @param[in] size size of the working area
@@ -150,7 +150,7 @@ Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size,
if (wsp == NULL)
return NULL;
tp = chThdInit(wsp, size, prio, pf, arg);
- tp->p_flags = P_MEM_MODE_HEAP;
+ tp->p_flags = THD_MEM_MODE_HEAP;
return chThdResume(tp);
}
#endif /* CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP */
@@ -187,7 +187,7 @@ Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
if (wsp == NULL)
return NULL;
tp = chThdInit(wsp, mp->mp_object_size, prio, pf, arg);
- tp->p_flags = P_MEM_MODE_MEMPOOL;
+ tp->p_flags = THD_MEM_MODE_MEMPOOL;
tp->p_mpool = mp;
return chThdResume(tp);
}
@@ -235,9 +235,9 @@ tprio_t chThdSetPriority(tprio_t newprio) {
Thread *chThdResume(Thread *tp) {
chSysLock();
- chDbgAssert(tp->p_state == PRSUSPENDED,
+ chDbgAssert(tp->p_state == THD_STATE_SUSPENDED,
"chThdResume(), #1",
- "thread not in PRSUSPENDED state");
+ "thread not in THD_STATE_SUSPENDED state");
chSchWakeupS(tp, RDY_OK);
chSysUnlock();
return tp;
@@ -254,7 +254,7 @@ Thread *chThdResume(Thread *tp) {
void chThdTerminate(Thread *tp) {
chSysLock();
- tp->p_flags |= P_TERMINATE;
+ tp->p_flags |= THD_TERMINATE;
chSysUnlock();
}
@@ -315,13 +315,13 @@ void chThdExit(msg_t msg) {
Thread *tp = currp;
chSysLock();
- tp->p_exitcode = msg;
+ tp->p_u.exitcode = msg;
THREAD_EXT_EXIT(tp);
#if CH_USE_WAITEXIT
if (tp->p_waiting != NULL)
chSchReadyI(tp->p_waiting);
#endif
- chSchGoSleepS(PREXIT);
+ chSchGoSleepS(THD_STATE_FINAL);
}
#if CH_USE_WAITEXIT
@@ -362,28 +362,28 @@ msg_t chThdWait(Thread *tp) {
chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self");
chDbgAssert(tp->p_waiting == NULL, "chThdWait(), #2", "some other thread waiting");
- if (tp->p_state != PREXIT) {
+ if (tp->p_state != THD_STATE_FINAL) {
tp->p_waiting = currp;
- chSchGoSleepS(PRWAIT);
+ chSchGoSleepS(THD_STATE_WTEXIT);
}
- msg = tp->p_exitcode;
+ msg = tp->p_u.exitcode;
#if !CH_USE_DYNAMIC
chSysUnlock();
return msg;
#else /* CH_USE_DYNAMIC */
/* Returning memory.*/
- tmode_t mode = tp->p_flags & P_MEM_MODE_MASK;
+ tmode_t mode = tp->p_flags & THD_MEM_MODE_MASK;
chSysUnlock();
switch (mode) {
#if CH_USE_HEAP
- case P_MEM_MODE_HEAP:
+ case THD_MEM_MODE_HEAP:
chHeapFree(tp);
break;
#endif
#if CH_USE_MEMPOOLS
- case P_MEM_MODE_MEMPOOL:
+ case THD_MEM_MODE_MEMPOOL:
chPoolFree(tp->p_mpool, tp);
break;
#endif