Thank you, Mark. That is a very helpful explanation.
--Ray
- I would like to know if protocol clauses for Stream Device protocols are atomic.
I believe they are atomic with certain caveats:
- Before the “out” command is executed the input stream is flushed. This should remove any stale input.
- The asyn port is locked so that the complete protocol is executed without releasing the lock. This ensures that 2 records cannot interfere.
A problem can occur however if the previous command “in” timed out but the device does eventually send the response. If it sends its response after the flush before the next “out” command then the response to that “out” command will be
the previous response, not the expected response. You should set the timeout long enough to prevent this.
If you are using any stream device records with SCAN=I/O Intr you must be sure that your protocol consumes all of the input from the device. If not that input could mistakenly be used for another protocol.
Mark
I would like to know if protocol clauses for Stream Device protocols are atomic. For example, if one thread is processing clause
# /// Read the input curve number
getINCRV {
out "INCRV? \$1";
in "%d"
}
and another thread is simultaneously processing (in the same IOC) clause
getInputCurveNumber {
out "INCRV? \$2";
in "%(\$1)d";
}
can these collide and interfere with each other? Or is there a blocking mechanism to help ensure that the ‘in’ of one clause is really the response to the preceding ‘out’ of the same clause?
Thank you,
--Ray