取消
显示结果 
搜索替代 
您的意思是: 

One sender multiple notifier

已解决!
转到解答

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 项奖励
1 条消息(共 6 条)
4,308 次查看
解答
接受人 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 项奖励
2 条消息(共 6 条)
4,288 次查看

@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 项奖励
3 条消息(共 6 条)
4,277 次查看

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

 

@Yamaeda: I can see the intention behind it

0 项奖励
4 条消息(共 6 条)
4,262 次查看

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 项奖励
5 条消息(共 6 条)
4,211 次查看

@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 项奖励
6 条消息(共 6 条)
4,198 次查看