use thread_specific_ptr in scheduler