DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Benefits of using Broadcast over Global Variables

Solved!
Go to solution

Maybe this is a very innocent question, but what would be the most benefits of using Broadcast instead of Global Variables, or Network-published variables (between PC and RT target)?

 

Thank you very much.

 

Pacino

0 Kudos
Message 1 of 2
(1,907 Views)
Solution
Accepted by topic author Jinghang

Hi, this is a good question!

 

These are the benefits I can visualize right now

 

  • Minimize the risk of race conditions because the broadcast event is generated by the module itself and there can be as many listeners as you need, the global variable in contrast can be many writers and many readers.
  • Registration to a module broadcast assures you react to each broadcast update in contrast to a global, you can't be aware when the global is being written, in fact, you will need to use polling with the global.

Enrique

 

 

Message 2 of 2
(1,905 Views)