Fix 100% CPU and wedges with gcc 4.8
Fix 100% CPU and wedges with gcc 4.8

This was caused by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58931
In short, waiting for a monotonic clock's infinity would overflow,
causing no wait at all. Worse yet, the mutex wouldn't even be released
and reacquired, so all other threads get starved.

The work-around in this commit is to sleep for no longer than one hour
(after an hour, you'll get a spurious interrupt).

Fix #49: 100% cpu in event loop
Fix #50: leader process hangs after Conrol-C

tempbottle/logcabin,dankenigsberg/logcabin,logcabin/logcabin,chaozh/logcabin,gaoning777/logcabin,chaozh/logcabin,tempbottle/logcabin,dankenigsberg/logcabin,TigerZhang/logcabin,chaozh/logcabin,TigerZhang/logcabin,TigerZhang/logcabin,nhardt/logcabin,gaoning777/logcabin,gaoning777/logcabin,tempbottle/logcabin,tempbottle/logcabin,logcabin/logcabin,nhardt/logcabin,dankenigsberg/logcabin,nhardt/logcabin,TigerZhang/logcabin,logcabin/logcabin,gaoning777/logcabin,dankenigsberg/logcabin,logcabin/logcabin,nhardt/logcabin,chaozh/logcabin