scvalex/daemons — pull request #1 by isturdy (2013-04-05 19:49:35+00:00)
Title: Added killAndWait to System.Posix.Daemon

I found that since System.Posix.Daemon.kill leaves the killed process responsible for releasing its pidfile, code such as
```haskell
kill "name.pid" >> runDetached (Just "name.pid") def startServer
```
consistently fails because the runDetached requests its lock before the prior process releases it. This patch adds a variant of kill, killAndWait, that uses System.Posix.IO.waitToSetLock to block until the new process can be safely started.

I do not think this a critical change, but unless I am missing some other way to handle the problem (other than repeatedly trying until success) it seems to greatly ease full-down restarts.