diff options
| author | Johan Dahlin <johan@src.gnome.org> | 2004-08-02 11:03:05 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2004-08-02 11:03:05 +0000 |
| commit | 3e41db376f6e40c2df01a1f83c2ecf10a5315084 (patch) | |
| tree | a4146d2ca0d7516cbcd334048286a710e2692a58 /gobject/gobjectmodule.c | |
| parent | fa82703297dadadf71b26650a8bafd55fc101dce (diff) | |
| download | pygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.tar.gz pygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.tar.xz pygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.zip | |
Call PyEval_InitThreads. Perhaps its something that always should bePYGTK_2_3_95
* gobject/gobjectmodule.c (initgobject): Call
PyEval_InitThreads. Perhaps its something that always should be
called.
* README (Author): Add a requirements section
* configure.in: Require Python 2.3
* setup.py (version): Ditto
* gobject/pygtype.c, gobject/pygobject.h: Remove 2.2 compat.
* All over the place: Add support for PyGILState.
Diffstat (limited to 'gobject/gobjectmodule.c')
| -rw-r--r-- | gobject/gobjectmodule.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 6027254..709ecd0 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -328,8 +328,10 @@ pyg_object_set_property (GObject *object, guint property_id, { PyObject *object_wrapper, *retval; PyObject *py_pspec, *py_value; + PyGILState_STATE state; pyg_block_threads(); + state = PyGILState_Ensure(); object_wrapper = pygobject_new(object); @@ -353,6 +355,7 @@ pyg_object_set_property (GObject *object, guint property_id, Py_DECREF(py_pspec); Py_DECREF(py_value); + PyGILState_Release(state); pyg_unblock_threads(); } @@ -362,8 +365,10 @@ pyg_object_get_property (GObject *object, guint property_id, { PyObject *object_wrapper, *retval; PyObject *py_pspec; + PyGILState_STATE state; pyg_block_threads(); + state = PyGILState_Ensure(); object_wrapper = pygobject_new(object); @@ -382,6 +387,7 @@ pyg_object_get_property (GObject *object, guint property_id, Py_DECREF(py_pspec); Py_XDECREF(retval); + PyGILState_Release(state); pyg_unblock_threads(); } @@ -1249,10 +1255,12 @@ handler_marshal(gpointer user_data) { PyObject *tuple, *ret; gboolean res; + PyGILState_STATE state; g_return_val_if_fail(user_data != NULL, FALSE); pyg_block_threads(); + state = PyGILState_Ensure(); tuple = (PyObject *)user_data; ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0), @@ -1264,6 +1272,8 @@ handler_marshal(gpointer user_data) res = PyObject_IsTrue(ret); Py_DECREF(ret); } + + PyGILState_Release(state); pyg_unblock_threads(); return res; @@ -1348,12 +1358,14 @@ pyg_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs) static gboolean iowatch_marshal(GIOChannel *source, GIOCondition condition, gpointer user_data) { + PyGILState_STATE state; PyObject *tuple, *func, *firstargs, *args, *ret; gboolean res; g_return_val_if_fail(user_data != NULL, FALSE); pyg_block_threads(); + state = PyGILState_Ensure(); tuple = (PyObject *)user_data; func = PyTuple_GetItem(tuple, 0); @@ -1373,6 +1385,7 @@ iowatch_marshal(GIOChannel *source, GIOCondition condition, gpointer user_data) Py_DECREF(ret); } + PyGILState_Release(state); pyg_unblock_threads(); return res; @@ -1599,6 +1612,8 @@ pyg_flags_add_constants(PyObject *module, GType flags_type, static gboolean pyg_error_check(GError **error) { + PyGILState_STATE state; + g_return_val_if_fail(error != NULL, FALSE); if (*error != NULL) { @@ -1606,6 +1621,7 @@ pyg_error_check(GError **error) PyObject *d; pyg_block_threads(); + state = PyGILState_Ensure(); exc_instance = PyObject_CallFunction(gerror_exc, "z", (*error)->message); @@ -1627,6 +1643,7 @@ pyg_error_check(GError **error) Py_DECREF(exc_instance); g_clear_error(error); + PyGILState_Release(state); pyg_unblock_threads(); return TRUE; @@ -1809,6 +1826,7 @@ initgobject(void) d = PyModule_GetDict(m); #ifdef ENABLE_PYGTK_THREADING + PyEval_InitThreads(); if (!g_threads_got_initialized) g_thread_init(NULL); #endif |
