chEvtBroadcastFlags with no listeners

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

chEvtBroadcastFlags with no listeners

Post by Korken »

Hi all!

I have a question about the chEvtBroadcastFlags.
What is the defined behaviour when there are no listeners?

From the code I am unsure how

Code: Select all

while (elp != (event_listener_t *)esp)
will evaluate.
Could someone clarify?

More or less I wonder if I have to check if someone is listening:

Code: Select all

osalSysLock();

if (chEvtIsListeningI(&my_events_es))
{
    chEvtBroadcastFlagsI(&my_events_es,
                         MY_EVENTMASK);
    osalOsRescheduleS();
}

osalSysUnlock();
or just if

Code: Select all

chEvtBroadcastFlags(&my_es,
                    MY_EVENTMASK);
will execute correctly.

Thanks!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chEvtBroadcastFlags with no listeners

Post by Giovanni »

If nobody is listening then events are like screams in the storm, no effect.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: chEvtBroadcastFlags with no listeners

Post by Korken »

Nice! Then I can just go with chEvtBroadcastFlags(&my_es, MY_EVENTMASK); :)
Thanks for the info Giovanni!
Post Reply