LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization Question

Hello,

 

I have created a program which contains two parallel loops running concurrently. One is an event loop the other is a 10HZ

while loop.reading data over TCP socket. The event loop has calbacks that use same TCP socket for writing /reading data over TCP.

Do I need to provide synchronized (I.e semaphores etc) accesss to TCP? For example, if callback event occurs before 10Hz

loop iteraion,will the 10hz loop defer until callback has completed. I believe that the labview TCP read VI is blocks until data is available and I have 5 sec timeout

in TCP read

 

Thanks

 

0 Kudos
Message 1 of 7
(2,931 Views)
You'd better transfer your write and read actions from the event loop to the 10Hz while loop. You could use a queue for that. In that case the 10Hz loop can perform a write and read when necessary and continu to monitor when no other actions are required.
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 7
(2,904 Views)

Hello Hershey,

 

Can you post a small chuck on code that displays what you are doing?  I'm assuming your are trying to communicate with the same port in both of the loops.  Is this correct?

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 3 of 7
(2,890 Views)

Hello,

port shouild be the same but take quick look at code.

 

Thanks

0 Kudos
Message 4 of 7
(2,880 Views)

Hello,

 

Here are some other VIs I am using. Perhaps you need these to understand what is going on

 

Thanks

0 Kudos
Message 5 of 7
(2,855 Views)

Hello,

 

Last 2 VI's. Could not attach more than 3 seperately.

 

Thank you

Download All
0 Kudos
Message 6 of 7
(2,854 Views)

Hello Hershey,

 

It looks like almost all of your TCP/IP communication takes place in  SBC Communication for Encoder.vi. I looked at the VI properties for this VI and it is set to be nonreentrant. This means that this entire VI will complete before it can be executed from another spot in your main VI. Because of this you do not need to protect this VI by semaphores.

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 7 of 7
(2,843 Views)