Okay, Per merlyn's suggestion I rewrote the code so that
it doesn't use SIG{ALRM}. Instead it just
uses a standard select call (as opposed to two system calls
inside of a signal handler) and the code works much smoother.
It's also shorter so that's a good sign too. Thanks for the help.