Skip to content

Commit

Permalink
Fix the stack-use-after-scope
Browse files Browse the repository at this point in the history
  • Loading branch information
GabTux committed Apr 18, 2024
1 parent 65e05d5 commit 8814340
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/source/thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ TEST_CASE("Test premature exit") {
{
dp::thread_pool<> testPool(2);

auto end = [&]() { id_end = std::this_thread::get_id(); };
auto end = [&id_end]() { id_end = std::this_thread::get_id(); };

auto task_2 = [&]() {
auto task_2 = [&testPool, end]() {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
testPool.enqueue_detach(end);
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
};

auto task_1 = [&]() {
auto task_1 = [&testPool, &id_task_1, task_2]() {
id_task_1 = std::this_thread::get_id();
testPool.enqueue_detach(task_2);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
Expand Down

0 comments on commit 8814340

Please sign in to comment.