diff --git a/mindspore/ccsrc/backend/session/executor.cc b/mindspore/ccsrc/backend/session/executor.cc index 26df6185d5c..09a61f47113 100644 --- a/mindspore/ccsrc/backend/session/executor.cc +++ b/mindspore/ccsrc/backend/session/executor.cc @@ -278,11 +278,11 @@ void Executor::ClearDoneTasks() { } void Executor::RunTask(const std::shared_ptr &task, bool sync, bool long_run) { + sync_run_task_finished_ = false; { std::lock_guard lock(task_mutex_); ready_tasks_.push(task); } - sync_run_task_finished_ = false; task_cond_var_.notify_all(); if (sync && !sync_run_task_finished_) { std::unique_lock lock(task_mutex_);