diff options
author | Martin v. Loewis <martin@v.loewis.de> | 2013-03-24 22:12:19 +0100 |
---|---|---|
committer | Martin v. Loewis <martin@v.loewis.de> | 2013-03-24 22:12:19 +0100 |
commit | 650458ab36c29cfd3906f4940eabd01b8b523b5c (patch) | |
tree | 4463730700404c235bb38a2479a382a4d1c71653 /Python/pystate.c | |
parent | 29a7032a9fa9327c158d9d09a8d7a8942c4f87d5 (diff) | |
parent | e298eef2c67880b4773a6678310b066406385824 (diff) | |
download | cpython-650458ab36c29cfd3906f4940eabd01b8b523b5c.tar.gz |
merge 3.3
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 9 |
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) { |