@@ -41,9 +41,11 @@ class DanglingContext;
4141
4242// / A callback to create a given Service.
4343using ServiceInit = std::function<ServiceHandle(ServiceRegistry&, DeviceState&, fair::mq::ProgOptions&)>;
44- // / A callback invoked whenever we start running, before the user callback.
44+ // / A callback invoked whenever we start running, before the user processing callback.
4545using ServiceStartCallback = std::function<void (ServiceRegistry&, void *)>;
46- // / A callback invoked whenever we stop running, before we exit.
46+ // / A callback invoked whenever we stop running, after the user processing callback.
47+ using ServiceStopCallback = std::function<void (ServiceRegistry&, void *)>;
48+ // / A callback invoked whenever we stop running completely, before we exit.
4749using ServiceExitCallback = std::function<void (ServiceRegistry&, void *)>;
4850
4951// / A callback to configure a given Service. Notice that the
@@ -150,6 +152,8 @@ struct ServiceSpec {
150152
151153 // / Callback invoked on Start
152154 ServiceStartCallback start = nullptr ;
155+ // / Callback invoked on Start
156+ ServiceStopCallback stop = nullptr ;
153157 // / Callback invoked on exit
154158 ServiceExitCallback exit = nullptr ;
155159 // / Callback invoked on driver entering the INIT state
@@ -197,6 +201,11 @@ struct ServiceStartHandle {
197201 void * service;
198202};
199203
204+ struct ServiceStopHandle {
205+ ServiceStopCallback callback;
206+ void * service;
207+ };
208+
200209struct ServiceExitHandle {
201210 ServiceExitCallback callback;
202211 void * service;
0 commit comments