LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 library multithread safe?

Is RS232 library multithread safe?
Another words, Can I call functions from this library for different ports at the same time?
 
For example
Can I call following functions at the same time from different thread?
:
written = ComWrt (1, send, strlen(send));
 
written = ComWrt (2, send, strlen(send));
 
written = ComWrt (3, send, strlen(send));
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 1 of 4
(3,691 Views)
NI says that it is.

I think you should be able to call rs-232 library functions on the same port from different threads within the same process too.

Threads from different processes cannot access the same port, however.

You have to take care with the rs232err library global though, it gets updated by all threads so you can have indeterminancy on the value when multi-threaded.  This is all discussed in the on-line help.

Menchar
0 Kudos
Message 2 of 4
(3,687 Views)
Yes, the library is thread-safe.  It ensures that calls from different threads do not interfere with each other.  It also does not matter which port you are writing to; you could just as safely write to the same port from multiple threads.

Mert A.
National Instruments
0 Kudos
Message 3 of 4
(3,682 Views)
Thanks for your answers. It addresses my concern.
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 4 of 4
(3,678 Views)