LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queue question

Solved!
Go to solution

Hi,

In LabVIEW how would I know the number of times that an element has been enqueued and/or dequeued ?

 

Thanks

dphan128

0 Kudos
Message 1 of 6
(3,265 Views)

I don't understand your question.

 

Any given element in the queue is enqueued only once.  And it can be dequeued only once.

0 Kudos
Message 2 of 6
(3,262 Views)

You have to maintain count in a numeric variable. Increment it every time you enqueue/de-queue. 

Best,
Aniket
0 Kudos
Message 3 of 6
(3,245 Views)
Do you mean how many elements are currently in the queue? If so you can use the 'preview queue' vi
David
www.controlsoftwaresolutions.com
0 Kudos
Message 4 of 6
(3,228 Views)

What I meant was that I enqueued the same element into queue more than one time thru a For Loop. The element is an instruction that carries a different parameter each time. So I want to know when the last instruction was executed or how many times has it been dequeued so I can signal an ending.

Thanks

0 Kudos
Message 5 of 6
(3,199 Views)
Solution
Accepted by topic author dphan128

Make one of the parameters a count of how many times it has been enqueued.  You will have to keep track of the count separately and pass it in as a parameter.  You could also include a timestamp as a parameter to tell when it has been enqueued.  If you only can pass one parameter, make it a cluster with the elements being your normal parameter, count, and timestamp.  You should write an enque subvi that takes care of incrementing the count and updating the timestamp.  Then call the subvi instead of the normal enque function.

 

- tbob

Inventor of the WORM Global
Message 6 of 6
(3,195 Views)