Phone:(705) 671-2652
    Fax:(705) 671-6127
   Email: tom@ontrak.net
Home Products Programming Applications Custom Designs Ordering News
    
ADU  Series - USB Data Acquisition Interface SDK 

Timeout Processing

The default behavior of ADU pipes is to wait (block) until a read or write operation completes. This may make the application appear to be "hung" while it waits for I/O.

The AduHid DLL provides the capability to use timeouts for reads and writes.

Activate timeout processing by supplying a non-zero value for the iTimeout argument when an ADU pipe is opened.

        HANDLE hDevice;
        hDevice = OpenAduDevice(1);

Any non-zero value for iTimeout will activate the timeout processing.

On every read and write supply the iTimeout in milli-seconds as the fifth argument.

        iRC = WriteAduDevice(hDevice, "RK1", 3, 0, 500);

The above call waits 500 milli-seconds for the write operation to complete. If the waiting period expires then 0 is returned to the iRC field. Calling GetLastError immediately after a timeout will yield an error code of 1460 (ERROR_TIMEOUT).

All pending I/O operations for the pipe are cancelled when a timeout occurs. This applies to both write and read operations. (eg. if a read times out then all pending writes and reads on the pipe are cancelled).

When I/O operations timeout the program will have to take appropriate action to retry or inform the user of trouble.

An alternative to timeouts is multi-threading, but that is beyond the scope of this document.

NOTE: The iTimeout parameter must be zero if timeout processing was not activated during the opening of the pipe.

NOTE: Each pipe has its own timeout property. For example the ADU Device pipe may be using timeouts while the ADU Stream pipe is in blocking mode.

 
    
Contact Information
Address Telephone Electronic Mail
Ontrak Control Systems Inc.
764 Notre Dame Ave., Unit #1
Tel: (705) 671-2652 General Information Sales or Support
Sudbury,Ontario Fax:(705) 671-6127 tom@ontrak.net
CANADA P3A 2T2    
              
Next-Day shipping anywhere in Continental U.S. via Fed-Ex
Copyright © 2012 ONTRAK CONTROL SYSTEMS 764 Notre Dame Ave, Unit #1 , Sudbury, Ontario, CANADA P3A 2T2  
"Quality serial Data Acquisition Interfaces"           PH. (705) 671-2652 FAX (705) 671-6127