mirror of
https://github.com/python/cpython.git
synced 2026-01-05 06:52:26 +00:00
fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). (gh-97965)
(cherry picked from commit b9d2e81716)
Co-authored-by: Dong-hee Na <donghee.na@python.org>
This commit is contained in:
parent
d163d5976d
commit
e39b511c2b
2 changed files with 8 additions and 1 deletions
|
|
@ -0,0 +1,2 @@
|
|||
:func:`os.sched_yield` now release the GIL while calling sched_yield(2).
|
||||
Patch by Dong-hee Na.
|
||||
|
|
@ -7096,8 +7096,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue