11 s826_adcwaitcancel, S826_adcwaitcancel – Sensoray 826 User Manual

Page 27

Advertising
background image

The function will operate in either blocking or non-blocking mode depending on the value of tmax. If tmax is zero, the
function will return immediately. If tmax is greater than zero, the calling thread will block until all requested data is
available or tmax elapses. In either case, the function will copy to buf all data from slots of interest that have a new
result. The function will return S826_ERR_NOTREADY if any of the requested slot data is unavailable.

This function will return S826_ERR_CANCELLED if, while it is blocking, another thread calls S826_AdcWaitCancel
to cancel waits on any of the slots of interest. 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, no result data will be copied to buf.

In triggered mode, the board's internal MissedTrigger error flag will be set if a trigger occurs while an ADC burst is in
progress. When the MissedTrigger flag is active, S826_AdcRead will wait for the requested slot data to arrive and then
it will clear the MissedTrigger flag and return S826_ERR_MISSEDTRIG. If multiple threads are waiting in
S826_AdcRead, only the first thread to return will receive S826_ERR_MISSEDTRIG; the other waiting threads will
not receive this error.

Thread-safe operation is guaranteed only if the slots of interest for any given thread do not coincide with those of
another thread. For example, thread safety would be assured if one thread designates slots 1 and 3-5 as slots of interest
while another thread designates slots 2 and 9. Thread safety would be compromised, though, if both threads shared a
common slot of interest.

5.3.11 S826_AdcWaitCancel

The S826_AdcWaitCancel function cancels a blocking wait on one or more slots.

int S826_AdcWaitCancel(
uint board, // board identifier
uint slotlist // slots to cancel
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

slotlist

Set of bit flags, one bit per slot, that indicate slots for which waiting is to be canceled. Bits 0-15 correspond to slots
0-15.

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is an error code.

Remarks

This function cancels blocking for an arbitrary set of slots so that another thread, which is blocked by S826_AdcRead
while waiting for adc data to arrive, will return immediately with S826_ERR_CANCELLED.

826 Instruction Manual

22

Analog Inputs

Advertising