LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to allow multiple application instances talk to each other

I'm working on a project that requires up to 3 instances of an application that will all run simultaneously. The application instances are launched from a central “traffic cop” application that passes instance specific parameters via a couple of Global variables. Each instance utilizes it’s own set of GPIB controlled instruments, with the exception of one instrument that is shared between all 3.This instrument then becomes the “gate” for the other instances; if they need the instrument, they will have to wait until it becomes available. I have the launching of the instances and passing of specific parameters all worked out, but not the sharing of the instrument.

 

The way I need it to work is that one instance will take control of the shared instrument, and when that instance has finished with it, make it available for another application instance to take control. So the other instances need to be able to check for availability of the instrument while another has it in use and wait for it to become available. I have been thinking of passing a variable around as a way to keep track of who has control, but I am worried about how things will react if 2 of the instances attempt to change the variable at the same time.

 

Does anyone have any ideas of a clean way to implement a way of having separate applications communicate with each other and share this type of resource?

 

0 Kudos
Message 1 of 3
(3,323 Views)

If you have the FDS version of CVI, then you might want to look at the Windows SDK Mutex facilities, which should be exactly what you need.

JR

0 Kudos
Message 2 of 3
(3,317 Views)
The Semaphore looks like it will do what I want. I'm going to give it a go and see what happens. Thanks for the input! Steve
0 Kudos
Message 3 of 3
(3,270 Views)