Bits and bobs to get thread-aware IO blocking working better.