Page 1 of 1

chEvtBroadcastFlags with no listeners

Posted: Thu Mar 19, 2015 10:47 pm
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!

Re: chEvtBroadcastFlags with no listeners

Posted: Thu Mar 19, 2015 11:04 pm
by Giovanni
If nobody is listening then events are like screams in the storm, no effect.

Giovanni

Re: chEvtBroadcastFlags with no listeners

Posted: Thu Mar 19, 2015 11:29 pm
by Korken
Nice! Then I can just go with chEvtBroadcastFlags(&my_es, MY_EVENTMASK); :)
Thanks for the info Giovanni!