avoid multiple running drive tasks for the same object
This commit is contained in:
15
interface.c
15
interface.c
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user