![]() |
Consolix
|
Interface for components supporting shutdown logic. More...
#include <IShutdownable.hpp>
Public Member Functions | |
| virtual | ~IShutdownable ()=default |
| Virtual destructor for polymorphic use. | |
Protected Member Functions | |
| virtual void | shutdown (int signal)=0 |
| Handles shutdown logic for the component. | |
Friends | |
| class | AppComponentManager |
| Grants access to the AppComponentManager class. | |
Interface for components supporting shutdown logic.
This interface defines a method for handling shutdown events, which is particularly useful for releasing resources, saving state, or performing cleanup operations when a termination signal is received. The callback runs during the application's normal shutdown path rather than directly from a POSIX signal handler. Access to the shutdown method is restricted to the AppComponentManager class.
Definition at line 19 of file IShutdownable.hpp.
|
virtualdefault |
Virtual destructor for polymorphic use.
|
protectedpure virtual |
Handles shutdown logic for the component.
This method is called when the application enters shutdown. Derived components should implement this method to perform necessary cleanup or save state before termination. On POSIX, a signal may trigger this shutdown, but the callback itself still runs later in normal application code.
| signal | The shutdown signal (e.g., SIGINT or SIGTERM). |
Implemented in consolix::BaseLoopComponent, and consolix::LoopComponent.
|
friend |
Grants access to the AppComponentManager class.
Definition at line 20 of file IShutdownable.hpp.