make gst_thread_get_current() work with threaded cothreads
authorBenjamin Otte <otte@gnome.org>
Mon, 21 Apr 2003 18:37:13 +0000 (18:37 +0000)
committerBenjamin Otte <otte@gnome.org>
Mon, 21 Apr 2003 18:37:13 +0000 (18:37 +0000)
Original commit message from CVS:
make gst_thread_get_current() work with threaded cothreads

gst/schedulers/gthread-cothreads.h

index c70f364..ed455eb 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <glib.h>
+#include <gst/gstthread.h>
 
 /* the name of this cothreads */
 #define COTHREADS_NAME         "gthread"
@@ -44,6 +45,7 @@ struct _cothread_context {
   cothread *            main;
   cothread *            current;
   GMutex *              mutex;
+  GstThread *          gst_thread; /* the GstThread we're running from */
 };
 
 struct _cothread {
@@ -101,6 +103,7 @@ do_cothread_context_init (void)
   ret->mutex = g_mutex_new ();
   ret->cothreads = NULL;
   ret->current = ret->main;
+  ret->gst_thread = gst_thread_get_current();
   g_mutex_lock (ret->mutex);
   
   return ret;
@@ -132,6 +135,7 @@ run_new_thread (gpointer data)
   cothread *self = (cothread *) data;
   
   g_mutex_lock (self->context->mutex);
+  g_private_set (gst_thread_current, self->context->gst_thread);
   g_cond_signal (self->creator->cond);
   g_cond_wait (self->cond, self->context->mutex);
   if (self->die)
@@ -217,7 +221,3 @@ do_cothread_destroy (cothread *thread)
 
 #define do_cothread_get_current(context) ((context)->current)
 #define do_cothread_get_main(context) ((context)->main)
-  
-  
-  
-