Make sure sleep never overflows the Int in threadDelay
Add timeout function
Rewrite withLockTry in terms of bracket
Fix up barrier to be safe and change multiple signalBarrier semantics
Optimise the implementation of Barrier, and the waitBarrier if there is no waiting to do