mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
AsyncObserver (#4444)
* feat(AsyncObserver): Improve NotificationCenter speed and usability #4414 * fix(Notification): add missing header * feat(Any): add checkers for holding nullptr #4447 * feat(NotificationCenter): g++ build and refactoring #4414 * fix(Observer): compile errors on some compilers #4414 * fix(NotificationCenter): compile errors #4414 * chore(ParallelSocketAcceptor): remove unnecessary include and using from header * feat(AsyncNotificationCenter): add #4414 * test(AsyncNotificationCenter): add mixed observer types to the test #4414 * fix(AsyncNotificationCenter): hangs on program exit #4414 * fix(dev): friend not honored, temporarily make private members public * fix(AsyncNotificationCenter); remove default #4414
This commit is contained in:
committed by
GitHub
parent
30a0a06bac
commit
88be66972a
@@ -74,15 +74,10 @@ public:
|
||||
void notify(Notification* pNf) const
|
||||
{
|
||||
Poco::Mutex::ScopedLock lock(_mutex);
|
||||
|
||||
if (_pObject)
|
||||
{
|
||||
N* pCastNf = dynamic_cast<N*>(pNf);
|
||||
if (pCastNf)
|
||||
{
|
||||
pCastNf->duplicate();
|
||||
(_pObject->*_method)(pCastNf);
|
||||
}
|
||||
pNf->duplicate();
|
||||
(_pObject->*_method)(static_cast<N*>(pNf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +87,15 @@ public:
|
||||
return pObs && pObs->_pObject == _pObject && pObs->_method == _method;
|
||||
}
|
||||
|
||||
bool accepts(Notification* pNf, const char* pName = 0) const
|
||||
[[deprecated("use `bool accepts(const Notification::Ptr&)` instead")]]
|
||||
bool accepts(Notification* pNf, const char* pName) const
|
||||
{
|
||||
return dynamic_cast<N*>(pNf) && (!pName || pNf->name() == pName);
|
||||
return (!pName || pNf->name() == pName) && (dynamic_cast<N*>(pNf) != nullptr);
|
||||
}
|
||||
|
||||
bool accepts(const Notification::Ptr& pNf) const
|
||||
{
|
||||
return (pNf.cast<N>() != nullptr);
|
||||
}
|
||||
|
||||
AbstractObserver* clone() const
|
||||
|
||||
Reference in New Issue
Block a user