diff options
author | Gustavo J. A. M. Carneiro <gcarneiro@src.gnome.org> | 2004-08-04 14:52:52 +0000 |
---|---|---|
committer | Gustavo J. A. M. Carneiro <gcarneiro@src.gnome.org> | 2004-08-04 14:52:52 +0000 |
commit | 272e668c19e45ad9f00312f89077d75bd74646c1 (patch) | |
tree | e0d2de911e9112e2332e9c985ce31b50af04238f /gobject/pygobject-private.h | |
parent | e3135078a867a0dcd44647a480d990210e7496c2 (diff) | |
download | pygobject-272e668c19e45ad9f00312f89077d75bd74646c1.tar.gz pygobject-272e668c19e45ad9f00312f89077d75bd74646c1.tar.xz pygobject-272e668c19e45ad9f00312f89077d75bd74646c1.zip |
make threading runtime optional
Diffstat (limited to 'gobject/pygobject-private.h')
-rw-r--r-- | gobject/pygobject-private.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h index 4ab1a26..770e692 100644 --- a/gobject/pygobject-private.h +++ b/gobject/pygobject-private.h @@ -19,6 +19,23 @@ extern struct _PyGObject_Functions pygobject_api_functions; (* pygobject_api_functions.unblock_threads)(); \ } G_STMT_END +#define pyg_threads_enabled (pygobject_api_functions.threads_enabled) +#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 +#define pyg_begin_allow_threads \ + G_STMT_START { \ + PyThreadState *_save = NULL; \ + if (pygobject_api_functions.threads_enabled) \ + _save = PyEval_SaveThread(); +#define pyg_end_allow_threads \ + if (pygobject_api_functions.threads_enabled) \ + PyEval_RestoreThread(_save); \ + } G_STMT_END + + extern GType PY_TYPE_OBJECT; void pyg_destroy_notify (gpointer user_data); |