move thread_context initialization into constructor