added support for no timeout (values less than 0, eg -1

Signed-off-by: Sean Nicholls <seannicholls@gmail.com>