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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user