1.1 --- a/libnotifier/include/notifier/notifier.h Wed Mar 22 16:14:29 2023 +0100
1.2 +++ b/libnotifier/include/notifier/notifier.h Wed Mar 22 16:15:04 2023 +0100
1.3 @@ -25,6 +25,7 @@
1.4 #include <list>
1.5 #include <map>
1.6 #include <mutex>
1.7 +#include <vector>
1.8
1.9 #include <resource/resource.h>
1.10 #include <systypes/base.h>
1.11 @@ -62,6 +63,8 @@
1.12 typedef std::map<notifiable_t *, ObjectNotificationState> ObjectNotificationStates;
1.13 typedef std::map<notifiable_t *, std::mutex> ObjectStateLocks;
1.14
1.15 +typedef std::vector<ipc_server_config_type *> ServerConfigs;
1.16 +
1.17
1.18
1.19 /* An object for monitoring object event notifications. */
1.20 @@ -83,7 +86,7 @@
1.21
1.22 /* Notifier resource details. */
1.23
1.24 - ipc_server_config_type *_config = NULL;
1.25 + ServerConfigs _configs;
1.26 bool _started = false;
1.27
1.28 /* Convenience method to access object state. */
2.1 --- a/libnotifier/lib/src/notifier.cc Wed Mar 22 16:14:29 2023 +0100
2.2 +++ b/libnotifier/lib/src/notifier.cc Wed Mar 22 16:15:04 2023 +0100
2.3 @@ -81,6 +81,12 @@
2.4
2.5 ObjectNotifier::~ObjectNotifier()
2.6 {
2.7 + ServerConfigs::iterator it;
2.8 +
2.9 + for (it = _configs.begin(); it != _configs.end(); it++)
2.10 + delete *it;
2.11 +
2.12 + _configs.clear();
2.13 }
2.14
2.15
2.16 @@ -102,7 +108,7 @@
2.17 if (err)
2.18 return err;
2.19
2.20 - _config = server.config();
2.21 + _configs.push_back(server.config());
2.22 _started = true;
2.23
2.24 return L4_EOK;
2.25 @@ -146,11 +152,12 @@
2.26
2.27 NotifierResource *resource = new NotifierResource(this, object);
2.28 ResourceServer server(resource);
2.29 - long err = server.start_in_thread(_config->thread, false);
2.30 + long err = server.start_in_thread(_configs.front()->thread, false);
2.31
2.32 if (err)
2.33 return err;
2.34
2.35 + _configs.push_back(server.config());
2.36 state.endpoint = server.config()->server;
2.37 }
2.38
2.39 @@ -204,9 +211,7 @@
2.40
2.41
2.42
2.43 -/* Handle a notification event for an object. Ideally, this would be invoked by
2.44 - the generic server dispatch mechanism, with the gate label being interpreted
2.45 - and provided as the first parameter. */
2.46 +/* Handle a notification event for an object. */
2.47
2.48 void GeneralObjectNotifier::notify(notifiable_t *object, notify_flags_t flags,
2.49 notify_values_t values)