scheduler thread race condition