safer initialization of thread_data