TaskSignal sets the calling task status to WAITING to prevent recursion through TaskYield.

r1982 | ffr | 2007-05-24 15:29:48 +1000 (Thu, 24 May 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-05-24 15:29:48 +10:00
committed by Douglas Clowes
parent 06264a4b4b
commit ae647f85fa

3
task.c
View File

@@ -327,12 +327,14 @@ ente:
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)
{ {
@@ -343,6 +345,7 @@ ente:
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);