LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
JICHFI

Enqueue array of elements

Status: New
EnqueueArray.PNG
26 Comments
Intaris
Proven Zealot

Or put the Queue reference itself into a single element queue and when you read it, it becomes unavailable for other processes to access.  When you're finished with it, pop it back in.  Behind the scenes probably actually more work than AQs idea but it allows you to pass only a single wire.

AristosQueue (NI)
NI Employee (retired)

Tweak Intaris' solution slightly -- use a Data Value Reference (DVR) instead of a single-element queue (SEQ). The DVRs solve the problem if you have to do multiple resource acquisition for a given operation. With SEQs, you're on your own to do mutex sorting. And DVRs make the mutex UNlock obvious and well sequenced.

 

Intaris' solution (whether with DVRs or with SEQs) does have a major advantage over the semaphores -- you cannot forget to acquire the lock before using the queue. 🙂 And it is the same performance as the semaphore solution. The only reason I don't promulgate that solution more is that a reference of a reference boggles some people, where as a semaphore guarding a queue is something more users in my experience grasp quickly.

 

Intaris
Proven Zealot

AQ Wrote:

 

"The only reason I don't promulgate that solution more is that a reference of a reference boggles some people."

 

See, I can even reference your reference of a reference.  Smiley Very Happy

 

But seriously, I like the DVR approach.

tst
Knight of NI Knight of NI
Knight of NI

> The only reason I don't promulgate that solution more is that a reference of a reference boggles some people.

 

Are you sure it's not because most people have no idea what promulgate means? 😉


___________________
Try to take over the world!
AristosQueue (NI)
NI Employee (retired)

Elucidating a new term is trivial thanks to Google, Wikpedia, online dictionaries and other modern tools.

Grokking a new concept is as yet beyond the power of the Internet to easily enable.

tst
Knight of NI Knight of NI
Knight of NI

To be fair to NI, though, it is probably easier to understand than something like char**, at least as long as you have strict types and good naming/documentation. The limited API for each reference type also helps.


___________________
Try to take over the world!