Rework DefaultNotificationService registration.

- Instead of implicitly registering and unregistering a service
  instance on construction/destruction, DefaultNotificationService
  now exports explicit Register()/Unregister() calls, which subclasses
  are expected to call when they're ready.

- Adjust all implementing subclasses. Resolves an issue with deadlocks
  when booting a DEBUG=1 build.
This commit is contained in:
Rene Gollent
2013-04-22 18:42:21 -04:00
parent be573dcd88
commit c24adb2950
9 changed files with 42 additions and 4 deletions
+14 -2
View File
@@ -156,13 +156,11 @@ DefaultNotificationService::DefaultNotificationService(const char* name)
fName(name)
{
recursive_lock_init(&fLock, name);
NotificationManager::Manager().RegisterService(*this);
}
DefaultNotificationService::~DefaultNotificationService()
{
NotificationManager::Manager().UnregisterService(*this);
recursive_lock_destroy(&fLock);
}
@@ -253,6 +251,20 @@ DefaultNotificationService::RemoveListener(const KMessage* eventSpecifier,
}
status_t
DefaultNotificationService::Register()
{
return NotificationManager::Manager().RegisterService(*this);
}
void
DefaultNotificationService::Unregister()
{
NotificationManager::Manager().UnregisterService(*this);
}
status_t
DefaultNotificationService::ToEventMask(const KMessage& eventSpecifier,
uint32& eventMask)