daemon: Support clean daemon shutdown
authorMichael Hanselmann <hansmi@google.com>
Thu, 17 Nov 2011 11:01:33 +0000 (12:01 +0100)
committerMichael Hanselmann <hansmi@google.com>
Mon, 21 Nov 2011 07:36:29 +0000 (08:36 +0100)
commit2d6b541445a6791fb620be2910bf31162ce3ae4f
treee2c035ecc23384a286e22c1577d7ccd7270a1e4e
parentf5acf5d95a544322ed857b43832ef49d6b02f672
daemon: Support clean daemon shutdown

Instead of aborting the main loop as soon as a fatal signal (SIGTERM or
SIGINT) is received, additional logic allows waiting for tasks to finish
while I/O is still being processed.

If no callback function is provided the old behaviour--shutting down
on the first signal--is preserved.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
lib/daemon.py