#include <service.h>

Public Member Functions | |
| std::string | getStatusString () override |
| virtual bool | isRunning () |
| void | join () |
| RunnableService () | |
| bool | shutdown () override |
| bool | start () override |
| void | waitForShutdown () |
| void | waitForShutdown (std::chrono::milliseconds millis) |
| ~RunnableService () override=default | |
Public Member Functions inherited from Service | |
| ServiceState | getState () |
| Service () | |
| virtual | ~Service ()=default |
Protected Member Functions | |
| virtual void | run () |
| virtual bool | startWorkerThread () |
| virtual bool | stopWorkerThread () |
| virtual void | work ()=0 |
Protected Member Functions inherited from Service | |
| void | setState (ServiceState new_state) |
Private Attributes | |
| std::condition_variable | cv_ |
| std::mutex | mtx_ |
| std::thread | runnable_thread_ |
| std::atomic< bool > | should_run_ {} |
Interface that implements basic Service methods and provides a mechanism to start a thread. Any interesting work in the implemented class should be implemented in the "work" method. Note: start and shutdown methods should be override if the implementing class requires extra steps in either scenarios.
|
overridedefault |
|
inlineoverridevirtual |
|
inlinevirtual |
Return if the RunnableService work thread is active
|
inline |
|
inlineprotectedvirtual |
|
inlineoverridevirtual |
Stops the worker thread. Should be overridden if other actions are necessary to stop.
Reimplemented from Service.
Reimplemented in HardWorker.
|
inlineoverridevirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inline |
|
inline |
|
protectedpure virtual |
Implement this method to do work. Note: this method is assumed to NOT block, otherwise shutdown does nothing.
Implemented in Aws::CloudWatch::CloudWatchService< D, T >, and HardWorker.