08-14-2023 05:31 AM
08-14-2023 05:45 AM
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?
08-14-2023 07:14 AM
@அனிதா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.
08-14-2023 11:22 AM
@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.
08-17-2023 02:19 AM
Thanks for your reply GerdW,
What does it mean "avoid blocking behavior of empty queues"
08-17-2023 03:20 AM
Hi 26,
@அனிதா26 wrote:
What does it mean "avoid blocking behavior of empty queues"
This has been explained by J...