Skip to content

Commit

Permalink
[ coverity ] Fix coverity issue
Browse files Browse the repository at this point in the history
Resolves:
- double_unlock: ~unique_lock unlocks lk while it is unlocked.
By applying:
- letting unique_lock go out of scope naturally by limiting the scope of the lock.
- In this case, nnstreamer#2913 (using std::lock_guard) since wait() function from std::condition_variable is being called.

**Self evaluation:**
1. Build test:     [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: skykongkong8 <ss.kong@samsung.com>
  • Loading branch information
skykongkong8 authored and jijoongmoon committed Feb 11, 2025
1 parent 4d8714e commit 5a4a067
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions nntrainer/tensor/task_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ TaskExecutor::TaskExecutor(const std::string &n) :
task_cv.wait(lk, [&] { return !task_queue.empty() || stop_all; });
if (stop_all && task_queue.empty())
return;

auto &task_info = task_queue.front();

const auto &id = std::get<int>(task_info);
Expand All @@ -48,7 +47,6 @@ TaskExecutor::TaskExecutor(const std::string &n) :
callback(id, status);

task_queue.pop_front();
lk.unlock();
}
ml_logd("Task Thread(%s): finish thread", name.c_str());
});
Expand Down

0 comments on commit 5a4a067

Please sign in to comment.