optimize thread execute