summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@src.gnome.org>2004-09-29 16:26:28 +0000
committerJohn Ehresman <jpe@src.gnome.org>2004-09-29 16:26:28 +0000
commit8ef24da13db8694ce9ff0dc025ff4d7883cd9811 (patch)
tree70bfe36c9ec0ac498ef3cefaeed3b300202c099f
parent44d583628cb7ec1b08d5d7c38bca11479b192424 (diff)
downloadpygobject-8ef24da13db8694ce9ff0dc025ff4d7883cd9811.tar.gz
pygobject-8ef24da13db8694ce9ff0dc025ff4d7883cd9811.tar.xz
pygobject-8ef24da13db8694ce9ff0dc025ff4d7883cd9811.zip
Allow gtk_main to be invoked from a thread created by the threading modulePYGTK_2_4_0
* gobject/gobjectmodule.c (pyg_enable_threads): Allow gtk_main to be invoked from a thread created by the threading module by requiring the GIL be held when pyg_enable_threads is invoked.
-rw-r--r--gobject/gobjectmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 55b4298..434e6ba 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1459,6 +1459,8 @@ pyg_main_context_default (PyObject *unused)
static int pyg_thread_state_tls_key = -1;
+/* Enable threading; note that the GIL must be held by the current
+ thread when this function is called */
static int
pyg_enable_threads ()
{
@@ -1475,7 +1477,7 @@ pyg_enable_threads ()
}
if (PYGIL_API_IS_BUGGY && !use_gil_state_api) {
PyThreadState* state;
- state = PyGILState_GetThisThreadState();
+ state = PyThreadState_Get();
if ( state != NULL )
PyThread_set_key_value(pyg_thread_state_tls_key, state);
}