#include <IllegalSendError.hh>
Public Methods | |
IllegalSendError () | |
Create the exception. |
An example scenario is where you create an Type1Event and call EventSender<Type1Event>::send(Type1Event). This call to send() in turn calls the processEvent() method of a listener of Type1Event's. If this listener's method creates another Type1Event and calls EventSender<Type1Event>::send(Type1Event) on it, this will cause that listener's processEvent() to be called once more, and the process repeats. This is likely to trigger an infinite loop of event generation. The only case where this would not happen is if the listener keeps state information that changes between successive calls to processEvent(), such that it does not generate an event during one of those calls (the recursion ends), or if this listener deregister's itself from listening.
Since an infinite recursion is likely to cause a program crash, and since it is quite easy to make that kind of mistake, EventSender<EvType> forbids calling send() while a send() (for that event type) is in progress. It will throw a EventSender<EvType>::IllegalSendError if such a situation occurs.
Definition at line 60 of file IllegalSendError.hh.