Skip to content

Commit

Permalink
gh-96078: os.sched_yield release the GIL while calling sched_yield(2).
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Oct 6, 2022
1 parent f8edc6f commit 40c5725
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:func:`os.sched_yield` now release the GIL while calling sched_yield(2).
Patch by Dong-hee Na.
7 changes: 6 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -7075,8 +7075,13 @@ static PyObject *
os_sched_yield_impl(PyObject *module)
/*[clinic end generated code: output=902323500f222cac input=e54d6f98189391d4]*/
{
if (sched_yield())
int result;
Py_BEGIN_ALLOW_THREADS
result = sched_yield();
Py_END_ALLOW_THREADS
if (result < 0) {
return posix_error();
}
Py_RETURN_NONE;
}

Expand Down

0 comments on commit 40c5725

Please sign in to comment.