TaskSignal sets the calling task status to WAITING to prevent recursion through TaskYield.
This commit is contained in:
3
task.c
3
task.c
@ -304,12 +304,14 @@ int TaskYield(pTaskMan self)
|
|||||||
int TaskSignal(pTaskMan self, int iSignal, void *pSigData)
|
int TaskSignal(pTaskMan self, int iSignal, void *pSigData)
|
||||||
{
|
{
|
||||||
pTaskHead pTemp, pEnd;
|
pTaskHead pTemp, pEnd;
|
||||||
|
int myStatus = self->pCurrent->iStatus;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
assert(self->iID == TASKERID);
|
assert(self->iID == TASKERID);
|
||||||
|
|
||||||
/* Do one cycle until we are at the caller, then return to him */
|
/* Do one cycle until we are at the caller, then return to him */
|
||||||
pEnd = self->pCurrent;
|
pEnd = self->pCurrent;
|
||||||
|
pEnd->iStatus = WAITING;
|
||||||
IncrTaskPointer(self);
|
IncrTaskPointer(self);
|
||||||
while (self->pCurrent != pEnd) {
|
while (self->pCurrent != pEnd) {
|
||||||
if (self->pCurrent->pSignal) {
|
if (self->pCurrent->pSignal) {
|
||||||
@ -318,6 +320,7 @@ int TaskSignal(pTaskMan self, int iSignal, void *pSigData)
|
|||||||
IncrTaskPointer(self);
|
IncrTaskPointer(self);
|
||||||
}
|
}
|
||||||
/* finally, tell me about the thingie as well */
|
/* finally, tell me about the thingie as well */
|
||||||
|
pEnd->iStatus = myStatus;
|
||||||
if (pEnd->pSignal) {
|
if (pEnd->pSignal) {
|
||||||
pEnd->pSignal(pEnd->pData, iSignal, pSigData);
|
pEnd->pSignal(pEnd->pData, iSignal, pSigData);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user