summaryrefslogtreecommitdiff
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorMartin v. Loewis <martin@v.loewis.de>2013-03-24 22:12:19 +0100
committerMartin v. Loewis <martin@v.loewis.de>2013-03-24 22:12:19 +0100
commit650458ab36c29cfd3906f4940eabd01b8b523b5c (patch)
tree4463730700404c235bb38a2479a382a4d1c71653 /Python/pystate.c
parent29a7032a9fa9327c158d9d09a8d7a8942c4f87d5 (diff)
parente298eef2c67880b4773a6678310b066406385824 (diff)
downloadcpython-650458ab36c29cfd3906f4940eabd01b8b523b5c.tar.gz
merge 3.3
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index cfd61d0098..70038936d6 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -697,6 +697,15 @@ PyGILState_GetThisThreadState(void)
return (PyThreadState *)PyThread_get_key_value(autoTLSkey);
}
+int
+PyGILState_Check(void)
+{
+ /* can't use PyThreadState_Get() since it will assert that it has the GIL */
+ PyThreadState *tstate = (PyThreadState*)_Py_atomic_load_relaxed(
+ &_PyThreadState_Current);
+ return tstate && (tstate == PyGILState_GetThisThreadState());
+}
+
PyGILState_STATE
PyGILState_Ensure(void)
{