You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidnotify(constvoid* pSender, TArgs& args)
/// Sends a notification to all registered delegates. The order is/// determined by the TStrategy. This method is blocking. While executing,/// the list of delegates may be modified. These changes don't/// influence the current active notifications but are activated with/// the next notify. If a delegate is removed during a notify(), the/// delegate will no longer be invoked (unless it has already been/// invoked prior to removal). If one of the delegates throws an exception,/// the notify method is immediately aborted and the exception is propagated/// to the caller.
{
Poco::ScopedLockWithUnlock<TMutex> lock(_mutex);
if (!_enabled) return;
// thread-safeness:// copy should be faster and safer than blocking until// execution ends
TStrategy strategy(_strategy);
lock.unlock();
strategy.notify(pSender, args);
}
The comment says:
If a delegate is removed during a notify(), the
delegate will no longer be invoked (unless it has already been
invoked prior to removal).
So if an object being destructed is being notified that will cause a segfault. Wouldn't it be better to just lock during the whole notification?
The text was updated successfully, but these errors were encountered:
@arturoc it's been a while, but we're finally cleaning the backlog.
I'm not sure I understand the concern - how would locking the entire function scope prevent an object from being destroyed? And, which object is of concern - event, strategy, delegate?
in AbstractEvent::notify:
The comment says:
So if an object being destructed is being notified that will cause a segfault. Wouldn't it be better to just lock during the whole notification?
The text was updated successfully, but these errors were encountered: