LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to wait on a queue and on a notifier at the same time?

Solved!
Go to solution

@crossrulz wrote:

Of course, if going Jeff's route, you don't even need the notifier; the data is in the queue.

But not the up-to-date data, or did I overlook something?

0 Kudos
Message 31 of 37
(891 Views)

@AStankov wrote:

But not the up-to-date data, or did I overlook something?


Yup,  with the mod I made to crossrulz exampleif multiple slider events are fired only one (the first) slider command is allowed in the queue but the notifier data is refreshed so that when slider is processed the latest slider value is applied.  It really was an interesting challenge.  Of course, you could just keep the slider command filter, and dump the notifier for a (Gasp!) Local variable read in the consumer to achieve the exact same performance!


"Should be" isn't "Is" -Jay
0 Kudos
Message 32 of 37
(885 Views)

@JÞB wrote:

@AStankov wrote:

But not the up-to-date data, or did I overlook something?


Yup,  with the mod I made to crossrulz exampleif multiple slider events are fired only one (the first) slider command is allowed in the queue but the notifier data is refreshed so that when slider is processed the latest slider value is applied.  It really was an interesting challenge.  Of course, you could just keep the slider command filter, and dump the notifier for a (Gasp!) Local variable read in the consumer to achieve the exact same performance!


Or you could not worry about re-loading the queue and just use the notifier's timeout like in my example.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 33 of 37
(880 Views)

It is probably also a question of personal preference. But it is also important to know if only one slider is watched or multiple controls. One would then probably need multiple notifiers.

Also, is speed so important for UI events or is it more important to prevent the queue from filling up with events.

0 Kudos
Message 34 of 37
(868 Views)

Well, after thinking again, now it looks like I am going to solve my problem through a simple FGV with a flag inside. The flag will signal if the FGV has been already read out by the consumer, in that case a new "slider" message can be enqueued, otherwise the slider value will be updated but no enqueue will be performed, because a previous "slider" message is still in the queue and needs to be processed. On the other hand the FGV can be also used to always store the latest slider value or even the values of multiple controls if required. Of course I could also read the slider directly or through a local var inside the consumer, but the FGV inbetween offers additional flexibility, e.g. one could check if a control has been set to an allowed value before the FGV is updated in order to be read by the consumer.

0 Kudos
Message 35 of 37
(853 Views)

That sounds like a really good solution.  1.  You avoid the extra enqueueing and messing with the queue.  2. You still keep the latest value.  3.  You don't have to keep track of another set of references.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 36 of 37
(850 Views)

@crossrulz wrote:

That sounds like a really good solution.  1.  You avoid the extra enqueueing and messing with the queue.  2. You still keep the latest value.  3.  You don't have to keep track of another set of references.


Exactly, somehow I forgot to list the main benefits 🙂 Thanks again! BTW crossrulz, I will try to mark your post as the solution to the topic of the thread, as it fits best. Jeff's solution is actually an extension of it.

0 Kudos
Message 37 of 37
(848 Views)