Implement task priorities and message queues

This commit is contained in:
Douglas Clowes
2015-07-29 17:47:46 +10:00
parent 0db57b9bae
commit eff54a5fd9
24 changed files with 1440 additions and 269 deletions

View File

@ -28,6 +28,7 @@ static void KillBckTask(void *data)
if (self->command) {
free(self->command);
}
free(self);
}
/*---------------------------------------------------------------------------*/
@ -44,6 +45,7 @@ static int BackgroundTask(void *data)
/*----------------------------------------------------------------------------*/
int BackgroundCommand(SConnection * pCon, char *command)
{
long lID;
pBckTask self = NULL;
self = calloc(1, sizeof(BckTask));
@ -58,7 +60,8 @@ int BackgroundCommand(SConnection * pCon, char *command)
return 0;
}
TaskRegisterN(pServ->pTasker, self->command, BackgroundTask, NULL, KillBckTask, self, 1);
lID = TaskRegisterN(pServ->pTasker, self->command, BackgroundTask, NULL, KillBckTask, self, TASK_PRIO_LOW);
SCPrintf(pCon, eValue, "bg = %ld", lID);
return 1;
}
@ -76,7 +79,6 @@ int BackgroundAction(SConnection * pCon, SicsInterp * pSics,
SCWrite(pCon, "ERROR: out of memory starting task", eError);
return 0;
}
SCSendOK(pCon);
return 1;
}