Replaces calls to write on file descriptor 2 with calls to write_message,
which writes to STDOUT_FILENO (1) and properly deals with the return of
write.
Before this change, several tests did not detect early deadlocks
because they used SIGALRM as the expected signal, and they ran
for the full default TIMEOUT seconds.
This commit adds a new delayed_exit function to the test skeleton,
along with several error-checking wrappers to pthread functions.
Additional error checking is introduced into several tests.