use ppoll to prevent signal race condition