From 8ef24da13db8694ce9ff0dc025ff4d7883cd9811 Mon Sep 17 00:00:00 2001 From: John Ehresman Date: Wed, 29 Sep 2004 16:26:28 +0000 Subject: Allow gtk_main to be invoked from a thread created by the threading module * 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. --- gobject/gobjectmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- cgit