top01.jpg (17169 bytes)
mleft.jpg (4986 bytes) m01a.jpg (6169 bytes)     m02a.jpg (6905 bytes)     m03a.jpg (7743 bytes)    m04a.jpg (7456 bytes)     m05a.jpg (7878 bytes)     m06a.jpg (6862 bytes)     m07a.jpg (6076 bytes) mright01.jpg (5078 bytes)

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.

 

NEWS         PRODUCTS         PROGRAMMING          APPLICATIONS          CUSTOM DESIGN          ORDERING          HOME


TestPoint is a trademark of Capital Equipment Corp.   
LabVIEW is a trademark of National Instruments.
Visual BASIC is a trademark of Microsoft Corporation


Copyright © 2002 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