LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 library threadsafe operation

Are there any concerns with using the RS232 library in a multithread operation as long as I do not attempt to access the same port from different threads? I am interested in using InstallComCallback to trigger on a received character. The multiple threads are generated by TestStand calling CVI routines for multiple UUTs in a batch sequence file model.
0 Kudos
Message 1 of 4
(3,235 Views)
No, the RS232 library is designed to be thread-safe and protect against simultaneous access.

Chris Matthews
National Instruments
Message 2 of 4
(3,235 Views)
Thanks Chris,

I had one other related question on the InstallComCallback. How do the port timeouts interact with the callback function. I was looking for something in the EventMask that would allow a port timeout to trigger the callback, but I did not see any way of setting this up.

Thanks,
Scott Trosper
0 Kudos
Message 3 of 4
(3,235 Views)
The callback can't be used to detect errors (except line status errors). You would have to check for a timeout or other errors by checking the return values of your RS232 functions (like ComRd) or by using the ReturnRS232Err and GetRS232ErrorString functions.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 4 of 4
(3,235 Views)