![]() |
Deskflow 1.24.0.365
Keyboard and mouse sharing utility
|
Win32 implementation of IArchDaemon. More...
#include <ArchDaemonWindows.h>


Public Types | |
| using | RunFunc = std::function<int()> |
| Public Types inherited from IArchDaemon | |
| using | DaemonFunc = std::function<int()> |
Public Member Functions | |
| ArchDaemonWindows () | |
| ~ArchDaemonWindows () override=default | |
| int | daemonize (DaemonFunc const &func) override |
| Daemonize the process. | |
| QString | commandLine () const override |
| Get the command line. | |
| Public Member Functions inherited from IArchDaemon | |
| virtual | ~IArchDaemon ()=default |
Static Public Member Functions | |
| static int | runDaemon (RunFunc runFunc) |
| Run the daemon. | |
| static void | daemonRunning (bool running) |
| Indicate daemon is in main loop. | |
| static void | daemonFailed (int result) |
| Indicate failure of running daemon. | |
| static UINT | getDaemonQuitMessage () |
| Get daemon quit message. | |
Win32 implementation of IArchDaemon.
| using ArchDaemonWindows::RunFunc = std::function<int()> |
| ArchDaemonWindows::ArchDaemonWindows | ( | ) |
|
overridedefault |
|
inlineoverridevirtual |
Get the command line.
Gets the command line with which the application was started.
Implements IArchDaemon.
|
static |
Indicate failure of running daemon.
The runFunc passed to runDaemon() should call this function to indicate failure. result is returned by daemonize().
|
overridevirtual |
Daemonize the process.
Daemonize. Throw ArchDaemonFailedException on error. name is the name of the daemon. Once daemonized, func is invoked and daemonize returns when and what it does.
Exactly what happens when daemonizing depends on the platform.
func gets passed one argument, the name passed to daemonize(). func is only called when the service is actually started. func must call ArchMiscWindows::runDaemon() to finally becoming a service. The runFunc function passed to runDaemon() must call ArchMiscWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and ArchMiscWindows::daemonRunning(false) when it leaves the main loop. The stopFunc function passed to runDaemon() is called when the daemon must exit the main loop and it must cause runFunc to return. func should return what runDaemon() returns. func or runFunc can call ArchMiscWindows::daemonFailed() to indicate startup failure. Implements IArchDaemon.
|
static |
Indicate daemon is in main loop.
The runFunc passed to runDaemon() should call this function to indicate when it has entered (running is true) or exited (running is false) the main loop.
|
static |
Get daemon quit message.
The windows NT daemon tells daemon thread to exit by posting this message to it. The thread must, of course, have a message queue for this to work.
Run the daemon.
When the client calls daemonize(), the DaemonFunc should call this function after initialization and argument parsing to perform the daemon processing. The runFunc should perform the daemon's main loop, calling daemonRunning(true) when it enters the main loop (i.e. after initialization) and daemonRunning(false) when it leaves the main loop. The runFunc is called in a new thread and when the daemon must exit the main loop due to some external control the getDaemonQuitMessage() is posted to the thread. This function returns what runFunc returns. runFunc should call daemonFailed() if the daemon fails.