@@ -227,32 +227,28 @@ void NotificationCenterTest::testDefaultNotificationCenter()
227
227
}
228
228
229
229
230
- void NotificationCenterTest::testDefaultAsyncNotificationCenter ()
230
+ void NotificationCenterTest::testMixedObservers ()
231
231
{
232
- using ObserverT = AsyncObserver<NotificationCenterTest, TestNotification>::Type;
232
+ using AObserverT = AsyncObserver<NotificationCenterTest, TestNotification>::Type;
233
233
234
- AsyncNotificationCenter& nc = AsyncNotificationCenter::defaultCenter () ;
234
+ AsyncNotificationCenter nc;
235
235
nc.addObserver (Observer<NotificationCenterTest, Notification>(*this , &NotificationCenterTest::handle1));
236
236
nc.addObserver (NObserver<NotificationCenterTest, Notification>(*this , &NotificationCenterTest::handleAuto));
237
- nc.addObserver (ObserverT (*this , &NotificationCenterTest::handleAsync1, &NotificationCenterTest::matchAsync));
237
+ nc.addObserver (AObserverT (*this , &NotificationCenterTest::handleAsync1, &NotificationCenterTest::matchAsync));
238
238
nc.postNotification (new Notification);
239
239
nc.postNotification (new TestNotification (" asyncNotification" ));
240
240
241
241
while (!_handle1Done || !_handleAuto1Done || !_handleAsync1Done)
242
242
Poco::Thread::sleep (100 );
243
243
244
- nc.removeObserver (ObserverT (*this , &NotificationCenterTest::handleAsync1, &NotificationCenterTest::matchAsync));
244
+ nc.removeObserver (AObserverT (*this , &NotificationCenterTest::handleAsync1, &NotificationCenterTest::matchAsync));
245
245
nc.removeObserver (NObserver<NotificationCenterTest, Notification>(*this , &NotificationCenterTest::handleAuto));
246
246
nc.removeObserver (Observer<NotificationCenterTest, Notification>(*this , &NotificationCenterTest::handle1));
247
247
Poco::Mutex::ScopedLock l (_mutex);
248
248
assertTrue (_set.size () == 3 );
249
249
assertTrue (_set.find (" handle1" ) != _set.end ());
250
250
assertTrue (_set.find (" handleAuto" ) != _set.end ());
251
251
assertTrue (_set.find (" handleAsync1" ) != _set.end ());
252
- // TODO: static object thread hangs without this on windows
253
- // for explanation/solution, see
254
- // https://stackoverflow.com/questions/10441048/exit-thread-upon-deleting-static-object-during-unload-dll-causes-deadlock
255
- nc.stop ();
256
252
}
257
253
258
254
@@ -344,7 +340,7 @@ CppUnit::Test* NotificationCenterTest::suite()
344
340
CppUnit_addTest (pSuite, NotificationCenterTest, testAsyncObserver);
345
341
CppUnit_addTest (pSuite, NotificationCenterTest, testAsyncNotificationCenter);
346
342
CppUnit_addTest (pSuite, NotificationCenterTest, testDefaultNotificationCenter);
347
- CppUnit_addTest (pSuite, NotificationCenterTest, testDefaultAsyncNotificationCenter );
343
+ CppUnit_addTest (pSuite, NotificationCenterTest, testMixedObservers );
348
344
349
345
return pSuite;
350
346
}
0 commit comments