Bug 980541 - Implement a timeout on read()

This is a suggested fix for the timeout. It works with Kyle testcase where we get an error instead of a hang.