Docs updates

Original commit message from CVS:
Docs updates
Changed the cothread to use sigjmp_buf
removed some unused methods.
Some code cleanups.
This commit is contained in:
Wim Taymans 2001-05-27 14:37:29 +00:00
parent 1523fcb150
commit b93de9e922
9 changed files with 79 additions and 55 deletions

View file

@ -159,7 +159,8 @@ cothread_create (cothread_context *ctx)
s->lock = g_mutex_new(); s->lock = g_mutex_new();
#endif #endif
GST_INFO (GST_CAT_COTHREADS,"created cothread #%d: %p at sp:%p", ctx->nthreads, s, s->sp); GST_INFO (GST_CAT_COTHREADS,"created cothread #%d: %p at sp:%p lock:%p", ctx->nthreads,
s, s->sp, s->lock);
ctx->threads[ctx->nthreads++] = s; ctx->threads[ctx->nthreads++] = s;
@ -201,7 +202,7 @@ cothread_main(cothread_context *ctx)
} }
/** /**
* cothread_current)main: * cothread_current_main:
* *
* Returns: the #cothread_state of the main (0th) thread in the current pthread * Returns: the #cothread_state of the main (0th) thread in the current pthread
*/ */
@ -335,7 +336,7 @@ cothread_switch (cothread_state *thread)
#ifdef GST_ARCH_PRESETJMP #ifdef GST_ARCH_PRESETJMP
GST_ARCH_PRESETJMP(); GST_ARCH_PRESETJMP();
#endif #endif
enter = setjmp(current->jmp); enter = sigsetjmp(current->jmp, 1);
if (enter != 0) { if (enter != 0) {
GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter, GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter,
current->sp, current->top_sp, current->top_sp-current->sp); current->sp, current->top_sp, current->top_sp-current->sp);
@ -350,7 +351,7 @@ cothread_switch (cothread_state *thread)
if (thread->flags & COTHREAD_STARTED) { if (thread->flags & COTHREAD_STARTED) {
GST_DEBUG (0,"in thread \n"); GST_DEBUG (0,"in thread \n");
// switch to it // switch to it
longjmp(thread->jmp,1); siglongjmp(thread->jmp,1);
} else { } else {
GST_ARCH_SETUP_STACK(thread->sp); GST_ARCH_SETUP_STACK(thread->sp);
GST_ARCH_SET_SP(thread->sp); GST_ARCH_SET_SP(thread->sp);
@ -378,7 +379,12 @@ selfswitch:
return; return;
} }
/**
* cothread_lock:
* @thread: cothread state to lock
*
* Locks the cothread state.
*/
void void
cothread_lock (cothread_state *thread) cothread_lock (cothread_state *thread)
{ {
@ -390,6 +396,14 @@ cothread_lock (cothread_state *thread)
#endif #endif
} }
/**
* cothread_trylock:
* @thread: cothread state to try to lock
*
* Try to lock the cothread state
*
* Returns: TRUE if the cothread could be locked.
*/
gboolean gboolean
cothread_trylock (cothread_state *thread) cothread_trylock (cothread_state *thread)
{ {
@ -403,6 +417,12 @@ cothread_trylock (cothread_state *thread)
#endif #endif
} }
/**
* cothread_unlock:
* @thread: cothread state to unlock
*
* Unlock the cothread state.
*/
void void
cothread_unlock (cothread_state *thread) cothread_unlock (cothread_state *thread)
{ {

View file

@ -53,7 +53,7 @@ struct _cothread_state {
int flags; int flags;
void *sp; void *sp;
jmp_buf jmp; sigjmp_buf jmp;
/* is this needed any more? */ /* is this needed any more? */
void *top_sp; void *top_sp;
void *pc; void *pc;

View file

@ -134,8 +134,6 @@ gst_bin_init (GstBin *bin)
bin->num_eos_providers = 0; bin->num_eos_providers = 0;
bin->chains = NULL; bin->chains = NULL;
bin->eoscond = g_cond_new (); bin->eoscond = g_cond_new ();
// FIXME temporary testing measure
// bin->use_cothreads = TRUE;
} }
/** /**
@ -644,14 +642,6 @@ gst_bin_restore_thyself (GstObject *object,
} }
} }
void
gst_bin_use_cothreads (GstBin *bin,
gboolean enabled)
{
g_return_if_fail (GST_IS_BIN (bin));
bin->use_cothreads = enabled;
}
/** /**
* gst_bin_iterate: * gst_bin_iterate:

View file

@ -82,7 +82,6 @@ struct _GstBin {
gint num_entries; gint num_entries;
cothread_context *threadcontext; cothread_context *threadcontext;
gboolean use_cothreads;
}; };
struct _GstBinClass { struct _GstBinClass {
@ -115,10 +114,6 @@ GtkType gst_bin_get_type (void);
GstElement* gst_bin_new (const gchar *name); GstElement* gst_bin_new (const gchar *name);
#define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin)) #define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin))
void gst_bin_set_element_manager (GstElement *element, GstElement *manager);
void gst_bin_add_managed_element (GstBin *bin, GstElement *element);
void gst_bin_remove_managed_element (GstBin *bin, GstElement *element);
/* add and remove elements from the bin */ /* add and remove elements from the bin */
void gst_bin_add (GstBin *bin, void gst_bin_add (GstBin *bin,
GstElement *element); GstElement *element);
@ -138,10 +133,6 @@ gboolean gst_bin_set_state_type (GstBin *bin,
gboolean gst_bin_iterate (GstBin *bin); gboolean gst_bin_iterate (GstBin *bin);
/* hack FIXME */
void gst_bin_use_cothreads (GstBin *bin,
gboolean enabled);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View file

@ -129,6 +129,7 @@ guint32 _gst_debug_categories = 0x00000000;
/** /**
* gst_default_debug_handler: * gst_default_debug_handler:
* @category: category of the DEBUG message * @category: category of the DEBUG message
* @incore: if the debug handler is for core code.
* @file: the file the DEBUG occurs in * @file: the file the DEBUG occurs in
* @function: the function the DEBUG occurs in * @function: the function the DEBUG occurs in
* @line: the line number in the file * @line: the line number in the file
@ -247,6 +248,7 @@ guint32 _gst_info_categories = 0x00000001;
/** /**
* gst_default_info_handler: * gst_default_info_handler:
* @category: category of the INFO message * @category: category of the INFO message
* @incore: if the info handler is for core code.
* @file: the file the INFO occurs in * @file: the file the INFO occurs in
* @function: the function the INFO occurs in * @function: the function the INFO occurs in
* @line: the line number in the file * @line: the line number in the file

View file

@ -152,6 +152,8 @@ gst_object_new (void)
* @object: GstObject to reference * @object: GstObject to reference
* *
* Increments the refence count on the object. * Increments the refence count on the object.
*
* Returns: A pointer to the object
*/ */
GstObject* GstObject*
gst_object_ref (GstObject *object) gst_object_ref (GstObject *object)
@ -370,13 +372,15 @@ gst_object_unparent (GstObject *object)
* @object: GstObject to reference * @object: GstObject to reference
* *
* Increments the refence count on the object. * Increments the refence count on the object.
*
* Returns: Apointer to the Object
*/ */
#ifndef gst_object_ref #ifndef gst_object_ref
void GstObject*
gst_object_ref (GstObject *object) gst_object_ref (GstObject *object)
{ {
g_return_if_fail (object != NULL); g_return_if_fail (object != NULL, NULL);
g_return_if_fail (GST_IS_OBJECT (object)); g_return_if_fail (GST_IS_OBJECT (object), NULL);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(object->refcount)) > 0); g_return_if_fail (atomic_read (&(object->refcount)) > 0);
@ -387,6 +391,8 @@ gst_object_ref (GstObject *object)
object->refcount++; object->refcount++;
GST_UNLOCK (object); GST_UNLOCK (object);
#endif #endif
return object;
} }
#endif /* gst_object_ref */ #endif /* gst_object_ref */

View file

@ -703,6 +703,23 @@ gst_pad_set_parent (GstPad *pad,
gst_object_set_parent (GST_OBJECT (pad), parent); gst_object_set_parent (GST_OBJECT (pad), parent);
} }
/**
* gst_pad_get_parent:
* @pad: the pad to get the parent from
*
* Get the parent object of this pad.
*
* Returns: the parent object
*/
GstElement*
gst_pad_get_parent (GstPad *pad)
{
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
return GST_PAD_PARENT (pad);
}
/** /**
* gst_pad_get_padtemplate: * gst_pad_get_padtemplate:
* @pad: the pad to get the padtemplate from * @pad: the pad to get the padtemplate from
@ -721,22 +738,12 @@ gst_pad_get_padtemplate (GstPad *pad)
} }
/** /**
* gst_pad_get_parent: * gst_pad_set_sched:
* @pad: the pad to get the parent from * @pad: the pad to set the scheduler for
* @sched: The scheduler to set
* *
* Get the parent object of this pad. * Set the sceduler for the pad
*
* Returns: the parent object
*/ */
GstElement*
gst_pad_get_parent (GstPad *pad)
{
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
return GST_PAD_PARENT (pad);
}
void void
gst_pad_set_sched (GstPad *pad, GstSchedule *sched) gst_pad_set_sched (GstPad *pad, GstSchedule *sched)
{ {
@ -746,6 +753,14 @@ gst_pad_set_sched (GstPad *pad, GstSchedule *sched)
GST_RPAD_SCHED(pad) = sched; GST_RPAD_SCHED(pad) = sched;
} }
/**
* gst_pad_get_sched:
* @pad: the pad to get the scheduler from
*
* Get the scheduler of the pad
*
* Returns: the scheduler of the pad.
*/
GstSchedule* GstSchedule*
gst_pad_get_sched (GstPad *pad) gst_pad_get_sched (GstPad *pad)
{ {
@ -761,7 +776,7 @@ gst_pad_get_sched (GstPad *pad)
* *
* Get the real parent object of this pad. If the pad * Get the real parent object of this pad. If the pad
* is a ghostpad, the actual owner of the real pad is * is a ghostpad, the actual owner of the real pad is
* returned, as opposed to the gst_pad_get_parent. * returned, as opposed to the gst_pad_get_parent().
* *
* Returns: the parent object * Returns: the parent object
*/ */

View file

@ -25,6 +25,8 @@
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#undef RTLD_GLOBAL
#include "gst_private.h" #include "gst_private.h"
#include "gstplugin.h" #include "gstplugin.h"
#include "gstversion.h" #include "gstversion.h"

View file

@ -126,10 +126,8 @@ struct _GstScheduleChain {
}; };
void gst_bin_schedule_func(GstBin *bin);
GtkType gst_schedule_get_type (void); GtkType gst_schedule_get_type (void);
GstSchedule * gst_schedule_new (GstElement *parent); GstSchedule* gst_schedule_new (GstElement *parent);
void gst_schedule_add_element (GstSchedule *sched, GstElement *element); void gst_schedule_add_element (GstSchedule *sched, GstElement *element);
void gst_schedule_remove_element (GstSchedule *sched, GstElement *element); void gst_schedule_remove_element (GstSchedule *sched, GstElement *element);