-
duration of function
Hi.
I´m creating software for control a device , but i have problem.
Code:
...
Data = 0;
i = 0;
while( i < NumberOfGate ){
if(FALSE == C8855ReadData( hC8855,
&CntData,
&ResultReturned)){;
Form1->Memo2->Lines->Add("Read data ERROR.");
return;
}
Data = CntData + Data;
i++;
if( Terminated ) break;
}
DataArray[z] = Data ;
...
Function C8855ReadData() read out data from device. Sometime is data lost by transmission of signal. At that time function (and software) to freeze, because still waiting to data.
I need fixed this problem.
Exist a function according any maximal time to executing my function
( C8855ReadData() )?
thx .... PoolO
-
You will need to put this data grabbing into a thread of it's own, so you can wait for completion and if it does not finish in a set amount of time, do something about it (cancel, retry or whatever).
-
Apart from the spawning a thread, another way is to use asynchronous read/write APIs.