Daemonize the process.
Daemonize. Throw XArchDaemonFailed 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.
-
unix: Detaches from terminal.
func gets passed one argument, the name passed to daemonize().
-
win32: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService().
func is only called when the service is actually started. func must call CArchMiscWindows::runDaemon() to finally becoming a service. The runFunc function passed to runDaemon() must call CArchMiscWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and CArchMiscWindows::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 CArchMiscWindows::daemonFailed() to indicate startup failure.
Reimplemented from CArchDaemonNone.
Definition at line 39 of file CArchDaemonUnix.cpp. |