taskd.pl: eliminate race conditions
commit0214e1e10d5e11ad2d6d96cd13cc3a9e77dbcda1
authorKyle J. McKay <mackyle@gmail.com>
Wed, 7 Oct 2015 16:41:58 +0000 (7 09:41 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 7 Oct 2015 16:41:58 +0000 (7 09:41 -0700)
tree4f95f002101e3eb86ef99c0aa23c5d5c78c3268a
parentac26811827e0b3bca84f98e29dfb88d4e594b0be
taskd.pl: eliminate race conditions

A signal could arrive after having already checked for
it.  If that happened it would take 30 seconds before
the condition would be noticed.

Although the window of opportunity is quite small, the
race did get lost on occasion.

Eliminate the race entirely by using a pipe write
or sigsuspend so the signal is always noticed right
away.

This does not, however, change the fact that it will
still take up to 30 seconds to notice a dead control
pipe.  That's not a problem because that's an
exceptional condition (taskd.pl was terminated by
a signal).

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
taskd/taskd.pl