Fix crashes related to uninitialized boost::thread_specific_ptrs.