From 6bed68913d23d49ea7a774a9e7daebd2e3624b96 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Wed, 6 Aug 2008 08:28:12 +0000 Subject: Add a pygobject_enable_threads wrapper around pyglib_threads_enable and 2008-08-06 Johan Dahlin * glib/pyglib.c (pyglib_enable_threads): * gobject/gobjectmodule.c (pyg_threads_init), (pygobject_enable_threads): Add a pygobject_enable_threads wrapper around pyglib_threads_enable and return 0/-1 which existing gobject based applications expect. svn path=/trunk/; revision=927 --- gobject/gobjectmodule.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gobject/gobjectmodule.c') diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 4d47d71..b7fadfd 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1788,13 +1788,22 @@ pygobject_gil_state_release (int flag) static PyObject * pyg_threads_init (PyObject *unused, PyObject *args, PyObject *kwargs) { - if (pyglib_enable_threads()) + if (!pyglib_enable_threads()) return NULL; Py_INCREF(Py_None); return Py_None; } +/* Only for backwards compatibility */ +int +pygobject_enable_threads(void) +{ + if (!pyglib_enable_threads()) + return -1; + return 0; +} + static PyObject * pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args) { @@ -2452,7 +2461,7 @@ struct _PyGObject_Functions pygobject_api_functions = { pyg_flags_from_gtype, FALSE, /* threads_enabled */ - pyglib_enable_threads, + pygobject_enable_threads, pygobject_gil_state_ensure, pygobject_gil_state_release, pyg_register_class_init, -- cgit