11 s826_diowaitcancel, S826_diowaitcancel – Sensoray 826 User Manual
Page 61
If the function fails, the return value is an error code.
Remarks
This function waits for edge events to be captured on an arbitrary set of DIO channels (the “channels of interest”) and
then returns information about the events. Event capturing must have been previously enabled for channels of interest
by calling S826_DioCapEnablesWrite.
Before calling the function, one or more chanlist bits must be set to identify the channels of interest. The function will
modify chanlist to indicate channels of interest that have captured events, and it will reset the capture flag registers for
all such indicated channels, thus re-enabling event capturing on those channels.
The function operates in either blocking or non-blocking mode depending on the value of tmax. If tmax is zero (non-
blocking mode), the function will return immediately. If tmax is greater than zero (blocking mode), the calling thread
will block until the capture criteria is satisfied or tmax elapses. In either case, some channels of interest may have
captured events while others may not have; these will be indicated by chanlist when the function returns.
In blocking mode, the capture criteria is specified by waitall. Depending on waitall, the function will wait for events to
be captured on either any, or all channels of interest. When waitall is true, the function will return when all channels of
interest have captured events. When waitall is false, the function will return when any channel of interest has captured
an event. The function will return S826_ERR_NOTREADY if tmax elapses before the capture criteria is satisfied.
In non-blocking mode, waitall is ignored and the function will never return S826_ERR_NOTREADY.
This function will return S826_ERR_CANCELLED if, while it is blocking, another thread calls S826_DioWaitCancel
to cancel waits on any of the blocking channels. It will return immediately if the wait criteria is completely satisfied
due to the wait cancellations, otherwise it will continue to block and return when all remaining wait criteria is satisfied.
S826_ERR_BOARDCLOSED will be returned immediately if S826_SystemClose executes while this function is
blocking. In either case, chanlist will be invalid when the function returns.
Thread-safe operation is guaranteed if the channels of interest for any given thread do not coincide with those of
another thread. For example, thread safety is assured if a thread designates channels 1 and 3-5 as channels of interest
while another thread designates channels 2 and 9.
8.3.11 S826_DioWaitCancel
The S826_DioWaitCancel function cancels a blocking wait on one or more DIO channels.
int S826_DioWaitCancel(
uint board, // board identifier
uint chanlist[2] // pointer to channel flags
);
Parameters
board
826 board number. This must match the settings of the board's dip switches as described in section 2.2.
chanlist
Pointer to DIO channel flag bits (see Section 8.3) that indicate channels for which waiting is to be cancelled.
Return Values
If the function succeeds, the return value is zero.
If the function fails, the return value is an error code.
826 Instruction Manual
56
Digital I/O