Thread: duration of function

  1. #1
    Registered User
    Join Date
    Aug 2010

    duration of function

    Im creating software for control a device , but i have problem.

    Data = 0;
    i = 0;
    while( i < NumberOfGate ){
    	if(FALSE == C8855ReadData( 	hC8855,
    		Form1->Memo2->Lines->Add("Read data ERROR.");
    	Data = CntData + Data;
    	 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
    Last edited by PoolO; 08-24-2010 at 06:50 AM.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Hannover, Germany
    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).

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Apart from the spawning a thread, another way is to use asynchronous read/write APIs.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Recursive function
    By WatchTower in forum C Programming
    Replies: 11
    Last Post: 07-15-2009, 07:42 AM
  3. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM