mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
make gst_thread_get_current() work with threaded cothreads
Original commit message from CVS: make gst_thread_get_current() work with threaded cothreads
This commit is contained in:
parent
fb14f53284
commit
b7077cab18
1 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue