summaryrefslogtreecommitdiffstats
path: root/Modules/_multiprocessing/semaphore.c
diff options
context:
space:
mode:
authormpage <mpage@meta.com>2024-05-09 16:05:52 (GMT)
committerGitHub <noreply@github.com>2024-05-09 16:05:52 (GMT)
commitc30d8e5d6c6b657817d6b342f1021676d04dd5af (patch)
treea8183c64dad61e0a92053387299e51ba5f2aa6d2 /Modules/_multiprocessing/semaphore.c
parentc3643a121401d111bebd3e26d6f362ade2ed2a83 (diff)
downloadcpython-c30d8e5d6c6b657817d6b342f1021676d04dd5af.zip
cpython-c30d8e5d6c6b657817d6b342f1021676d04dd5af.tar.gz
cpython-c30d8e5d6c6b657817d6b342f1021676d04dd5af.tar.bz2
gh-117657: Acquire a critical section around `SemLock.__{enter,exit}__` (#118812)
These methods are purely wrappers around `Semlock.{acquire,release}`, which expect a critical section to be held.
Diffstat (limited to 'Modules/_multiprocessing/semaphore.c')
-rw-r--r--Modules/_multiprocessing/semaphore.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 5bb055f..4de4ee6 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -682,6 +682,7 @@ _multiprocessing_SemLock__after_fork_impl(SemLockObject *self)
}
/*[clinic input]
+@critical_section
_multiprocessing.SemLock.__enter__
Enter the semaphore/lock.
@@ -689,12 +690,13 @@ Enter the semaphore/lock.
static PyObject *
_multiprocessing_SemLock___enter___impl(SemLockObject *self)
-/*[clinic end generated code: output=beeb2f07c858511f input=c5e27d594284690b]*/
+/*[clinic end generated code: output=beeb2f07c858511f input=d35c9860992ee790]*/
{
return _multiprocessing_SemLock_acquire_impl(self, 1, Py_None);
}
/*[clinic input]
+@critical_section
_multiprocessing.SemLock.__exit__
exc_type: object = None
@@ -709,7 +711,7 @@ static PyObject *
_multiprocessing_SemLock___exit___impl(SemLockObject *self,
PyObject *exc_type,
PyObject *exc_value, PyObject *exc_tb)
-/*[clinic end generated code: output=3b37c1a9f8b91a03 input=7d644b64a89903f8]*/
+/*[clinic end generated code: output=3b37c1a9f8b91a03 input=1610c8cc3e0e337e]*/
{
return _multiprocessing_SemLock_release_impl(self);
}