Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28595 Discussions

sport commands in a threaded application

hcra
Beginner
381 Views
Hi,
I have written a multithreaded serial communication application and it uses the functions outp and inp to communicate with the COM1 port. Recently I went about converting my code into calls using sport_read_line and sport_write_line instead of outp and inp. However I notice that the sport routine does not work well in a multithreaded case. As soon as I create a thread erroneous values are returned by the sport command. Do you have any pointers on how to make the sport commands function in a multithreaded case. Thanks,
-hcra
0 Kudos
2 Replies
Steven_L_Intel1
Employee
381 Views
From what I see in the documentation, using the SPORT routines in a multithreaded application should work. However, the documentation does say "To help ensure that data overruns do not occur, the SPORT_xxx run-time support creates a separate thread that maintains an outstanding read to the connected port. This thread is started when any read or write operation is performed to the port using the affiliated read/write routine. As such, port parameters must not be changed after you have started reading or writing to the port. Instead, you should set up the port parameters after connecting to the port and then leave them unchanged until after the port has been released."

If you can come up with a simple example that fails, and are using CVF 6.6B. please feel free to send it to vf-support@compaq.com

Steve
0 Kudos
pcurtis
Beginner
381 Views
For a complete module illustrating serial i/o in a multithreaded Win32 environment, written with Win32 API calls instead of the sport routines, please send an email request.
Paul Curtis
pcurtis@kiltel.com
0 Kudos
Reply