Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/test_with_catch/test_subinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,21 @@ TEST_CASE("Per-Subinterpreter GIL") {

// wait for something to set sync to our thread number
// we are holding our subinterpreter's GIL
while (sync != num)
std::this_thread::sleep_for(std::chrono::microseconds(1));
{
py::gil_scoped_release nogil;
while (sync != num)
std::this_thread::sleep_for(std::chrono::microseconds(1));
}

// now change it so the next thread can move on
++sync;

// but keep holding the GIL until after the next thread moves on as well
while (sync == num + 1)
std::this_thread::sleep_for(std::chrono::microseconds(1));
{
py::gil_scoped_release nogil;
while (sync == num + 1)
std::this_thread::sleep_for(std::chrono::microseconds(1));
}

// one last check before quitting the thread, the internals should be different
auto sub_int
Expand Down
Loading