LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can we convert queue to notifier by making the queue buffer size to 1

Can we convert queue to notifier by making the queue buffer size to 1

0 Kudos
Message 1 of 6
(1,267 Views)

Hi 26,

 


@அனிதா26 wrote:

Can we convert queue to notifier by making the queue buffer size to 1


Technically "yes"/"kind of"…

There are lossy queues and you can avoid blocking behaviour of empty queues - but why don't you use a notifier when you need one?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(1,260 Views)

@அனிதா26 wrote:

Can we convert queue to notifier by making the queue buffer size to 1


A Notifier holds a single Data Value AND a History object.   There is no method to remove (Flush) the Data or History.

 

This is NOT the equivalent of a Queue with a Max Buffer size of 1.  That Queue Buffer May hold 0 or 1 elements of Data and contains no history object.

 

Flush Queue and Dequeue operations will always leave the Queue you described with no elements.  In practice, you could always use Preview Queue to return an array containing the 0 or 1 Data elements in the Queue.....but the next developer will wonder what you were smoking when that wild idea popped into your head. 


"Should be" isn't "Is" -Jay
Message 3 of 6
(1,224 Views)

@JÞB wrote:

@அனிதா26 wrote:

Can we convert queue to notifier by making the queue buffer size to 1


A Notifier holds a single Data Value AND a History object.   There is no method to remove (Flush) the Data or History.

 

This is NOT the equivalent of a Queue with a Max Buffer size of 1.  That Queue Buffer May hold 0 or 1 elements of Data and contains no history object.

 


IIRC, not the Notifier itself but the callsite of the "Wait for Notifier" function has a history object. i.e. the timestamp of the last notifier which was returned so that the "ignore previous" can be used. This is a problem when "switching" notifier references on the same callsite.

 

But it is true that a Queue has no concept of "history" or "Ignore previous", if it has something, it will return it. If not, it won't.

Message 4 of 6
(1,188 Views)

Thanks for your reply GerdW,

 

 

What does it mean "avoid blocking behavior of empty queues"

0 Kudos
Message 5 of 6
(1,139 Views)

Hi 26,

 


@அனிதா26 wrote:

What does it mean "avoid blocking behavior of empty queues"


This has been explained by J...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,128 Views)