commented thread_wait method