LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One sender multiple notifier

Solved!
Go to solution

Hello everyone,

 

I have a basic question about the use of Notifiers. I branch of my Notifier-Reference to multiple statemachines. When I send a notification how can I clear this notification in all other References. basically I want the Notification to be called only once. See VI attached

 

After "Meldung" is notified, Meldung 2 should no be triggered because the message was already received. But the notifier of "Meldung2" is also triggered. 

 

Is this an intentional behavior? How can I clear other reference notifier after it was called once?

0 Kudos
Message 1 of 6
(3,899 Views)
Solution
Accepted by topic author s.h._tech

More information about your actual application would be helpful. For instance, how do you expect to send a notification to the second Wait for notifier? Did you notice the Cancel notifier function on the palette? As long as your notifications are serialized you could use this to cancel the notification prior to the next Wait for notifier.

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

@s.h._tech wrote:

Hello everyone,

 

I have a basic question about the use of Notifiers. I branch of my Notifier-Reference to multiple statemachines. When I send a notification how can I clear this notification in all other References. basically I want the Notification to be called only once. See VI attached

 

After "Meldung" is notified, Meldung 2 should no be triggered because the message was already received. But the notifier of "Meldung2" is also triggered. 

 

Is this an intentional behavior? How can I clear other reference notifier after it was called once?


Yes, that's per design, as the point of a notifier is to notify all ...

If you change it to a queue it'll be first come, first serve, as it'll be consumed upon first read.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(3,868 Views)

Cancel notification solved it. I did not know that all instances will be released.

 

@Yamaeda: I can see the intention behind it

0 Kudos
Message 4 of 6
(3,853 Views)

Depending on what you are actually implementing and the problem you are trying to solve, using Notifiers may not be the best choice. They may work, but may result in other undesirable side effects or bugs. If your intent is to only send it to one listener, you should be using a point to point mechanism like a queue. Notifiers are broadcast mechanisms. Due to timing limitations, canceling the notification may not always work. Another listener may get the notification before you actually cancel it.

 

Even if you intent is to have a pool of actors who can process the data and only one needs to do the work and it doesn't matter which one, a queue would be better option. Using a queue the first actor to grab the message will, the element will no longer be on the queue and the other actors will continue to wait.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 6
(3,802 Views)

@Mark_Yedinak wrote:

Depending on what you are actually implementing and the problem you are trying to solve, using Notifiers may not be the best choice. They may work, but may result in other undesirable side effects or bugs. If your intent is to only send it to one listener, you should be using a point to point mechanism like a queue. Notifiers are broadcast mechanisms. Due to timing limitations, canceling the notification may not always work. Another listener may get the notification before you actually cancel it.

 

Even if you intent is to have a pool of actors who can process the data and only one needs to do the work and it doesn't matter which one, a queue would be better option. Using a queue the first actor to grab the message will, the element will no longer be on the queue and the other actors will continue to wait.


That's why when I suggested it I added the caveat that the Wait for Notifiers had to be serialized as they were in the example. I totally agree that notifiers might not be the right approach, but without additional information it is impossible to suggest better options.

0 Kudos
Message 6 of 6
(3,789 Views)