Skip to content

Commit

Permalink
Making test more realistic
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Mar 25, 2020
1 parent 8742c55 commit 47579e9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libs/threading_base/tests/regressions/thread_local_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ void test()
{
hpx::threads::thread_id_type id = hpx::threads::get_self_id();
test_data* p = new test_data;
hpx::threads::add_thread_exit_callback(id, [p]() { delete p; });
hpx::threads::add_thread_exit_callback(id, [p, id]() {
hpx::threads::thread_id_type id1 = hpx::threads::get_self_id();
HPX_TEST_EQ(id1, id);

test_data* p1 =
reinterpret_cast<test_data*>(hpx::threads::get_thread_data(id1));
HPX_TEST_EQ(p1, p);

delete p;
});
hpx::threads::set_thread_data(id, reinterpret_cast<std::size_t>(p));
}

Expand Down

0 comments on commit 47579e9

Please sign in to comment.