Threads and global io lock