5 // This service can be induced to successfully start or fail (once it is STARTING) by calling either the
6 // started() or failed_to_start() functions.
8 class test_service : public service_record
11 test_service(service_set *set, std::string name, service_type_t type_p,
12 const std::list<prelim_dep> &deplist_p)
13 : service_record(set, name, type_p, deplist_p)
18 bool auto_stop = true; // whether to call stopped() immediately from bring_down()
20 // Do any post-dependency startup; return false on failure
21 virtual bool bring_up() noexcept override
23 // return service_record::bring_up();
27 // All dependents have stopped.
28 virtual void bring_down() noexcept override
30 waiting_for_deps = false;
36 void stopped() noexcept
38 service_record::stopped();
41 // Whether a STARTING service can immediately transition to STOPPED (as opposed to
42 // having to wait for it reach STARTED and then go through STOPPING).
43 virtual bool can_interrupt_start() noexcept override
45 return waiting_for_deps;
48 virtual bool interrupt_start() noexcept override
53 void started() noexcept
55 service_record::started();
58 void failed_to_start() noexcept
60 service_record::failed_to_start();