diff --git a/ChangeLog b/ChangeLog index 531a4d92dc..cd83b262fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-11-07 David I. Lehn + + * configure.ac: bump gstreamer version to 0.4.2, bump pygtk version to + 1.99.13 + * gstreamer/__init__.py: add "import pygtk; pygtk.require('2.0')" + * examples/gstreamer/dvdplay.py: updated to maybe work with threads + * pygtk.diff: add work-in-progress PyGTK threading improvements diff + +2002-10-23 David I. Lehn + + * gstreamer/gstreamer.override: override gst_bin_iterate() to unblock + threads since this call can cause exacution to re-enter the + interpreter. + 2002-10-04 David I. Lehn * gstreamer/gstreamer.override, gstreamer/gstreamer-fixes.h: add diff --git a/pygtk.diff b/pygtk.diff new file mode 100644 index 0000000000..d0cf844a2f --- /dev/null +++ b/pygtk.diff @@ -0,0 +1,131 @@ +Index: gtk/gdk.override +=================================================================== +RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gdk.override,v +retrieving revision 1.24 +diff -u -r1.24 gdk.override +--- gtk/gdk.override 24 Aug 2002 14:25:23 -0000 1.24 ++++ gtk/gdk.override 7 Nov 2002 07:26:25 -0000 +@@ -55,37 +55,96 @@ + * particularly appealing. + */ + #ifdef ENABLE_PYGTK_THREADING ++//#define LDBG ++#define LCNT ++//#define BMTX + static GStaticPrivate pythreadstate_key = G_STATIC_PRIVATE_INIT; +-static GStaticPrivate counter_key = G_STATIC_PRIVATE_INIT; +-#define INITIAL_LOCK_COUNT 1 ++static GStaticPrivate lock_count_key = G_STATIC_PRIVATE_INIT; ++static PyInterpreterState *pyinterpstate = NULL; ++#ifdef BMTX ++static GStaticMutex foo = G_STATIC_MUTEX_INIT; ++#endif + + static void + pygdk_block_threads (void) + { +- gint counter = GPOINTER_TO_INT(g_static_private_get(&counter_key)); ++ gint lock_count = GPOINTER_TO_INT(g_static_private_get(&lock_count_key)); ++#ifdef BMTX ++ g_static_mutex_lock(&foo); ++#endif + +- if (counter == INITIAL_LOCK_COUNT) { +- PyThreadState *_save; ++#ifdef LDBG ++ fprintf(stderr, "->b (%p) c %d\n", g_thread_self(), lock_count); ++#endif ++#ifdef LCNT ++ if (lock_count == 0) { ++#else ++ { ++#endif ++ PyThreadState *_save; + + _save = g_static_private_get(&pythreadstate_key); ++#ifdef LDBG ++ fprintf(stderr, "->b ->t (%p) (ts:%p) c %d\n", g_thread_self(), _save, lock_count); ++#endif ++ if (_save == NULL) { ++#ifdef LDBG ++ fprintf(stderr, "->b ->t _save == NULL (%p) c %d\n", g_thread_self(), lock_count); ++#endif ++ _save = PyThreadState_New(pyinterpstate); ++#ifdef LDBG ++ fprintf(stderr, "->b ->t (%p) (new ts:%p) c %d\n", g_thread_self(), _save, lock_count); ++#endif ++ } + Py_BLOCK_THREADS; ++#ifdef LDBG ++ fprintf(stderr, "->b <-t (%p) c %d\n", g_thread_self(), lock_count); ++#endif + } +- counter--; +- g_static_private_set(&counter_key, GINT_TO_POINTER(counter), NULL); ++ lock_count++; ++ g_static_private_set(&lock_count_key, GINT_TO_POINTER(lock_count), NULL); ++#ifdef LDBG ++ fprintf(stderr, "<-b (%p) c %d\n", g_thread_self(), lock_count); ++#endif ++#ifdef BMTX ++ g_static_mutex_unlock(&foo); ++#endif + } + static void + pygdk_unblock_threads (void) + { +- gint counter = GPOINTER_TO_INT(g_static_private_get(&counter_key)); ++ gint lock_count = GPOINTER_TO_INT(g_static_private_get(&lock_count_key)); ++#ifdef BMTX ++ g_static_mutex_lock(&foo); ++#endif + +- counter++; +- if (counter == INITIAL_LOCK_COUNT) { +- PyThreadState *_save; ++#ifdef LDBG ++ fprintf(stderr, "->u (%p) c %d\n", g_thread_self(), lock_count); ++#endif ++ lock_count--; ++#ifdef LCNT ++ if (lock_count == 0) { ++#else ++ { ++#endif ++ PyThreadState *_save; + ++#ifdef LDBG ++ fprintf(stderr, "->u ->t (%p) (ts:%p) c %d\n", g_thread_self(), g_static_private_get(&pythreadstate_key), lock_count); ++#endif + Py_UNBLOCK_THREADS; ++#ifdef LDBG ++ fprintf(stderr, "->u <-t (%p) (s:%p) (ts:%p) c %d\n", g_thread_self(), _save, g_static_private_get(&pythreadstate_key), lock_count); ++#endif + g_static_private_set(&pythreadstate_key, _save, NULL); + } +- g_static_private_set(&counter_key, GINT_TO_POINTER(counter), NULL); ++ g_static_private_set(&lock_count_key, GINT_TO_POINTER(lock_count), NULL); ++#ifdef LDBG ++ fprintf(stderr, "<-u (%p) c %d\n", g_thread_self(), lock_count); ++#endif ++#ifdef BMTX ++ g_static_mutex_unlock(&foo); ++#endif + } + #endif + +@@ -96,7 +155,14 @@ + /* register gdk thread block/unblock routines with gobjectmodule */ + pyg_set_thread_block_funcs (pygdk_block_threads, pygdk_unblock_threads); + ++ PyEval_InitThreads(); + gdk_threads_init(); ++ g_static_private_set(&lock_count_key, GINT_TO_POINTER(1), NULL); ++ ++#ifdef LDBG ++ fprintf(stderr, "%s:%s:%d thread state (%p)\n", __FILE__,__FUNCTION__,__LINE__, PyThreadState_Get()); ++#endif ++ pyinterpstate = PyThreadState_Get()->interp; + + Py_INCREF(Py_None); + return Py_None;