summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject-private.h
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@src.gnome.org>2004-09-27 17:57:41 +0000
committerJohn Ehresman <jpe@src.gnome.org>2004-09-27 17:57:41 +0000
commit5af9d80f2cced90b86b425fd3011b5cbed3b975b (patch)
tree2c0801617d2188adb867a57f67b571bb54cef183 /gobject/pygobject-private.h
parent4e66fa1cfa6d35ae97fc94a0c715abb04b79a0c3 (diff)
downloadpygobject-5af9d80f2cced90b86b425fd3011b5cbed3b975b.tar.gz
pygobject-5af9d80f2cced90b86b425fd3011b5cbed3b975b.tar.xz
pygobject-5af9d80f2cced90b86b425fd3011b5cbed3b975b.zip
New functions exposed through _PyGObject_Functions to work around bugs in
* gobject/gobjectmodule.c: New functions exposed through _PyGObject_Functions to work around bugs in the PyGILState api's * gobject/pygobject.h: idem * gobject/pygobject-private.h: idem * gtk/gtk.override (_wrap_gtk_main): add pyg_enable_threads() call to ensure thread state for thread invoking this function is remembered. Only call pyg_enable_threads() here if threads were previously enabled
Diffstat (limited to 'gobject/pygobject-private.h')
-rw-r--r--gobject/pygobject-private.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h
index e74ec0a..eb4b107 100644
--- a/gobject/pygobject-private.h
+++ b/gobject/pygobject-private.h
@@ -20,11 +20,22 @@ extern struct _PyGObject_Functions pygobject_api_functions;
} G_STMT_END
#define pyg_threads_enabled (pygobject_api_functions.threads_enabled)
+
+#ifndef PYGIL_API_IS_BUGGY
#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (PyGILState_Ensure()) : 0)
#define pyg_gil_state_release(state) G_STMT_START { \
if (pygobject_api_functions.threads_enabled) \
PyGILState_Release(state); \
} G_STMT_END
+#else
+#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (pygobject_api_functions.gil_state_ensure()) : 0)
+#define pyg_gil_state_release(state) G_STMT_START { \
+ if (pygobject_api_functions.threads_enabled) \
+ pygobject_api_functions.gil_state_release(state); \
+ } G_STMT_END
+
+#endif
+
#define pyg_begin_allow_threads \
G_STMT_START { \
PyThreadState *_save = NULL; \