daemonize.daemon

Platform independent parts of the library. Defines common signals that safe to catch, utilities for describing daemons and some utitility templates for duck typing. *

Members

Enums

Signal
enum Signal

Native signals that can be hooked. There arn't all linux native signals due safety. * Most not listed signals are already binded by druntime (sigusr1 and sigusr2 are occupied by garbage collector) and rebinding cause a program hanging or ignoring all signal callbacks. * You can define your own signals by customSignal function. These signals are mapped to realtime signals in linux. * Note: Signal enum is based on string to map signals on winapi events.

Functions

customSignal
Signal customSignal(string name)

Creating your own custom signal. Theese signals are binded to realtime signals in linux and to winapi events in Windows. *

Templates

Composition
template Composition(Signals...)

* Signal OR composition. * * If you'd like to hook several signals by one handler, you * can use the template in place of signal in KeyValueList * signal map. * * In that case the handler should also accept a Signal value * as it second parameter.

Daemon
template Daemon(string name, alias pSignalMap, alias pMainFunc)

Template for describing daemon in the package. * To describe new daemon you should set unique name and signal -> callbacks mapping. * name is used to name default pid and lock files of the daemon and also it is a service name in Windows. * pSignalMap is a KeyValueList template where keys are Signal values and values are delegates of type:

DaemonClient
template DaemonClient(string name, Signals...)

Truncated description of daemon for use with sendSignal function. You need to pass a daemon name and a list of signals to Signals expression list. *

isComposition
template isComposition(alias T)

Checks if T is a composition of signals

isDaemon
template isDaemon(alias T)

Duck typing Daemon description

isDaemonClient
template isDaemonClient(alias T)

Duck typing of DaemonClient

Meta

Authors

NCrashed <ncrashed@gmail.com>

License

Subject to the terms of the MIT license, as written in the included LICENSE file.