LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Large Clusters to Sub VI's

You missed a key point in my explanation.  You must use the "ReadForWrite" VI to get data from the repository if you want to write the repository.  The "ReadForWrite" VI contains the code to acquire the semaphore.  This code cannot be in the repository or you have a deadlock issue.  It occurs because the repository cannot be reentrant or it does not work (if it were reentrant, every instance of it would have different data, making the LV2 global useless).  Assume we put the acquire semaphore in the repository.  Consider the following sequence.
  1. Location 1 executes a "read for write", acquiring the semaphore.
  2. Location 2 attempts to execute a "read for write", but the semaphore is in use, so the repository waits for it to be released before giving the data.
  3. Location 1 attempts to write data, but the VI is in use, so waits.  A deadlock has occurred.
The solution is to acquire the semaphore in a reentrant VI that is not the repository.  That is what the "ReadForWrite" VI does.
0 Kudos
Message 11 of 13
(792 Views)

My humble apologies for taking up your time. I see my error.
In my responses above about 'the program', I was only referring to the Shakespearean Insults DEMO ('ShIn_MainVI3.vi'). In it, the 'ShIn_Insult_ReadForWrite.vi' is never used, so the 'Acquire Semaphore.vi' didn't show up in the hierarchy.

I hadn't looked at your 'GUI Templates' folder until now.
Thanks for the great templates. I've learned a lot from all of this.

0 Kudos
Message 12 of 13
(782 Views)
I should apologize to you.  The fact that the demo did not clearly illustrate the principles makes it a poor demo.  Thank you for the heads up!  I will improve it for the future.
0 Kudos
Message 13 of 13
(770 Views)