Mitigate race conditions in SIGUSR2 handling. See #798.