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)
|
||||
{
|
||||
pTaskHead pTemp, pEnd;
|
||||
int myStatus = self->pCurrent->iStatus;
|
||||
|
||||
assert(self);
|
||||
assert(self->iID == TASKERID);
|
||||
|
||||
/* Do one cycle until we are at the caller, then return to him */
|
||||
pEnd = self->pCurrent;
|
||||
pEnd->iStatus = WAITING;
|
||||
IncrTaskPointer(self);
|
||||
while (self->pCurrent != pEnd) {
|
||||
if (self->pCurrent->pSignal) {
|
||||
@ -318,6 +320,7 @@ int TaskSignal(pTaskMan self, int iSignal, void *pSigData)
|
||||
IncrTaskPointer(self);
|
||||
}
|
||||
/* finally, tell me about the thingie as well */
|
||||
pEnd->iStatus = myStatus;
|
||||
if (pEnd->pSignal) {
|
||||
pEnd->pSignal(pEnd->pData, iSignal, pSigData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user