Thread synchronisation for io operations
Merge branch 'master' into peercoin