avoid multiple running drive tasks for the same object

This commit is contained in:
2021-10-20 17:06:55 +02:00
parent 61341b52f4
commit f3d95891ad
4 changed files with 20 additions and 0 deletions

View File

@@ -224,9 +224,23 @@ static void DriveTaskSignal(void *data, int iSignal, void *pSigData)
taskData->pDriv->Halt(taskData->obj);
SCSetInterrupt(taskData->pCon,*interrupt);
}
} else if (iSignal == ENDDRIVETASK) {
if (taskData->obj == pSigData) {
taskData->pDriv = NULL; /* tell DriveTaskFunc to quit */
}
}
}
/*--------------------------------------------------------------------------*/
void EndDriveTask(void *obj) {
/* End a drive task for obj.
Originally in SICS, it was not possible to run an object already running
this was relaxed in SEA, but with the downside, that several drive tasks
for the same object may be running, removed only when the run succeds.
This is called in StartDevice, before creating a new drive task.
*/
TaskSignal(pServ->pTasker, ENDDRIVETASK, obj);
}
/*--------------------------------------------------------------------------*/
static int DriveTaskFunc(void *data)
{
DriveTaskData *taskData = (DriveTaskData *)data;
@@ -234,6 +248,7 @@ static int DriveTaskFunc(void *data)
assert(taskData != NULL);
if (!taskData->pDriv) return 0;
status = taskData->pDriv->CheckStatus(taskData->obj,taskData->pCon);
if(status == HWBusy){