Skip to content

Commit

Permalink
Add lock.
Browse files Browse the repository at this point in the history
  • Loading branch information
small-turtle-1 committed Dec 29, 2023
1 parent d71532e commit f8d30c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scheduler/fragment_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ u64 FragmentTask::FragmentId() const {
}

// Finished **OR** Error
bool FragmentTask::IsComplete() const { return sink_state_->prev_op_state_->Complete() || status_ == FragmentTaskStatus::kError; }
bool FragmentTask::IsComplete() {
UniqueLock<Mutex> lock(mutex_);
return sink_state_->prev_op_state_->Complete() || status_ == FragmentTaskStatus::kError;
}

// Stream fragment source has no data
bool FragmentTask::QuitFromWorkerLoop() {
Expand Down Expand Up @@ -142,7 +145,6 @@ TaskBinding FragmentTask::TaskBinding() const {
}

void FragmentTask::CompleteTask() {
UniqueLock<Mutex> lock(mutex_);
if (status_ == FragmentTaskStatus::kRunning) {
status_ = FragmentTaskStatus::kFinished;
}
Expand Down

0 comments on commit f8d30c4

Please sign in to comment.