LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can use the same thread safe variable in the different processes?

Hello,

 

Can  use the same thread safe variable in the different processes?  my application has a log file used to record some event, the log file will be accessed by the different process, is there any synchronous method to access the log file with CVI ?

 

David

0 Kudos
Message 1 of 2
(2,828 Views)

Limiting concurrent access to shared resources can be better obtained by using locks: once created, the lock can be get by one requester at a time by calling CmtGetLock, the other being blocked in the same call until the lock is free. If you do not want to lock a process you can use CmtTryToGtLock instead.

Don't forget to discard locks when you have finished using them or at program end.

 

Alternatively you can PostDeferredCall a unique function (executed in the main thread) to write the log passing the apprpriate data to it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,824 Views)