mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
fixed cothread locking and set_arg/get_arg safety, and switched to 64 cothreads of 32KB
Original commit message from CVS: fixed cothread locking and set_arg/get_arg safety, and switched to 64 cothreads of 32KB
This commit is contained in:
parent
51df56e1aa
commit
f3098e9546
3 changed files with 27 additions and 8 deletions
|
@ -36,8 +36,8 @@
|
|||
#include "gstarch.h"
|
||||
|
||||
|
||||
#define COTHREAD_STACKSIZE 16384
|
||||
#define COTHREAD_MAXTHREADS 128
|
||||
#define COTHREAD_STACKSIZE 32768
|
||||
#define COTHREAD_MAXTHREADS 64
|
||||
#define STACK_SIZE 0x200000
|
||||
|
||||
|
||||
|
@ -385,7 +385,8 @@ cothread_lock (cothread_state *thread)
|
|||
#ifdef COTHREAD_ATOMIC
|
||||
// do something to lock the cothread
|
||||
#else
|
||||
g_mutex_lock(thread->lock);
|
||||
if (thread->lock)
|
||||
g_mutex_lock(thread->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -395,7 +396,10 @@ cothread_trylock (cothread_state *thread)
|
|||
#ifdef COTHREAD_ATOMIC
|
||||
// do something to try to lock the cothread
|
||||
#else
|
||||
return g_mutex_trylock(thread->lock);
|
||||
if (thread->lock)
|
||||
return g_mutex_trylock(thread->lock);
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -405,7 +409,8 @@ cothread_unlock (cothread_state *thread)
|
|||
#ifdef COTHREAD_ATOMIC
|
||||
// do something to unlock the cothread
|
||||
#else
|
||||
g_mutex_unlock(thread->lock);
|
||||
if (thread->lock)
|
||||
g_mutex_unlock(thread->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ enum {
|
|||
|
||||
static void gst_element_class_init (GstElementClass *klass);
|
||||
static void gst_element_init (GstElement *element);
|
||||
static void gst_element_base_class_init (GstElementClass *klass);
|
||||
|
||||
static void gst_element_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_element_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
@ -75,7 +76,7 @@ GtkType gst_element_get_type(void) {
|
|||
(GtkObjectInitFunc)gst_element_init,
|
||||
(GtkArgSetFunc)gst_element_set_arg,
|
||||
(GtkArgGetFunc)gst_element_get_arg,
|
||||
(GtkClassInitFunc)NULL,
|
||||
(GtkClassInitFunc)gst_element_base_class_init,
|
||||
};
|
||||
element_type = gtk_type_unique(GST_TYPE_OBJECT,&element_info);
|
||||
}
|
||||
|
@ -143,6 +144,17 @@ gst_element_class_init (GstElementClass *klass)
|
|||
klass->elementfactory = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_base_class_init (GstElementClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*) klass;
|
||||
|
||||
gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_element_set_arg);
|
||||
gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_element_get_arg);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_init (GstElement *element)
|
||||
{
|
||||
|
|
|
@ -778,13 +778,15 @@ void gst_bin_schedule_func(GstBin *bin) {
|
|||
static void
|
||||
gst_schedule_lock_element (GstSchedule *sched,GstElement *element)
|
||||
{
|
||||
cothread_lock(element->threadstate);
|
||||
if (element->threadstate)
|
||||
cothread_lock(element->threadstate);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_schedule_unlock_element (GstSchedule *sched,GstElement *element)
|
||||
{
|
||||
cothread_unlock(element->threadstate);
|
||||
if (element->threadstate)
|
||||
cothread_unlock(element->threadstate);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue