Move thread wait to jthread implementation