Unix implementation of IArchDaemon. More...
#include <CArchDaemonUnix.h>
Inherits CArchDaemonNone.
Public Member Functions | |
| virtual int | daemonize (const char *name, DaemonFunc func) |
| Daemonize the process. | |
Unix implementation of IArchDaemon.
Definition at line 28 of file CArchDaemonUnix.h.
| int CArchDaemonUnix::daemonize | ( | const char * | name, | |
| DaemonFunc | func | |||
| ) | [virtual] |
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.
func gets passed one argument, the name passed to daemonize(). 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 68 of file CArchDaemonUnix.cpp.
1.7.1