mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
Removing unused code related to stack allocation (cothreads_stackquery(), gst_scheduler_get_preferred_stack())
Original commit message from CVS: Removing unused code related to stack allocation (cothreads_stackquery(), gst_scheduler_get_preferred_stack())
This commit is contained in:
parent
e04e9d291e
commit
2fed56b4a8
6 changed files with 1 additions and 90 deletions
|
@ -576,57 +576,6 @@ cothread_context_get_data (cothread_state * thread, gchar * key)
|
|||
return g_hash_table_lookup (ctx->data, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* cothreads_stackquery:
|
||||
* @stack: Will be set to point to the allocated stack location
|
||||
* @stacksize: Will be set to the size of the allocated stack
|
||||
*
|
||||
* Returns: #TRUE on success, #FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
cothread_stackquery (void **stack, glong* stacksize)
|
||||
{
|
||||
/* use either
|
||||
* - posix_memalign to allocate a 2M-aligned, 2M stack
|
||||
* or
|
||||
* - valloc
|
||||
*
|
||||
* memory allocated by either of these two can be freed using free ()
|
||||
* FIXME: define how the stack grows */
|
||||
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
int retval = posix_memalign (stack, STACK_SIZE, STACK_SIZE);
|
||||
if (retval != 0)
|
||||
{
|
||||
g_warning ("Could not posix_memalign stack !\n");
|
||||
if (retval == EINVAL)
|
||||
g_warning ("The alignment parameter %d was not a power of two !\n",
|
||||
STACK_SIZE);
|
||||
if (retval == ENOMEM)
|
||||
g_warning ("Insufficient memory to allocate the request of %d !\n",
|
||||
STACK_SIZE);
|
||||
*stacksize = 0;
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG (GST_CAT_THREAD, "have posix_memalign at %p of size %d",
|
||||
(void *) *stack, STACK_SIZE);
|
||||
#else
|
||||
if ((*stack = valloc (STACK_SIZE)) == NULL)
|
||||
{
|
||||
g_warning ("Could not valloc stack !\n");
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG (GST_CAT_THREAD, "have valloc at %p of size %d",
|
||||
(void *) *stack, STACK_SIZE);
|
||||
#endif
|
||||
|
||||
GST_DEBUG (GST_CAT_COTHREADS,
|
||||
"Got new cothread stack from %p to %p (size %ld)",
|
||||
*stack, *stack + STACK_SIZE - 1, (long) STACK_SIZE);
|
||||
*stacksize = STACK_SIZE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_switch:
|
||||
* @thread: cothread state to switch to
|
||||
|
|
|
@ -71,7 +71,6 @@ void cothread_setfunc (cothread_state *thread, cothread_func func,
|
|||
void cothread_stop (cothread_state *thread);
|
||||
|
||||
void cothread_switch (cothread_state *thread);
|
||||
gboolean cothread_stackquery (void **stack, glong* stacksize);
|
||||
void cothread_set_private (cothread_state *thread,
|
||||
gpointer data);
|
||||
gpointer cothread_get_private (cothread_state *thread);
|
||||
|
|
|
@ -94,27 +94,6 @@ gst_scheduler_setup (GstScheduler *sched)
|
|||
CLASS (sched)->setup (sched);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_scheduler_get_preferred_stack:
|
||||
* @sched: a #GstScheduler to query.
|
||||
* @stack: the pointer to store the location of the preferred stack in.
|
||||
* @size: the pointer to store the size of the preferred stack in.
|
||||
*
|
||||
* Gets the preferred stack location and size of this scheduler.
|
||||
*
|
||||
* Returns: TRUE if the scheduler suggested a preferred stacksize and location.
|
||||
*/
|
||||
gboolean
|
||||
gst_scheduler_get_preferred_stack (GstScheduler *sched, gpointer *stack, gulong *size)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_SCHEDULER (sched), FALSE);
|
||||
|
||||
if (CLASS (sched)->get_preferred_stack)
|
||||
return CLASS (sched)->get_preferred_stack (sched, stack, size);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_scheduler_reset:
|
||||
* @sched: a #GstScheduler to reset.
|
||||
|
|
|
@ -82,7 +82,6 @@ struct _GstSchedulerClass {
|
|||
|
||||
/* virtual methods */
|
||||
void (*setup) (GstScheduler *sched);
|
||||
gboolean (*get_preferred_stack) (GstScheduler *sched, gpointer *stack, gulong *size);
|
||||
void (*reset) (GstScheduler *sched);
|
||||
void (*add_element) (GstScheduler *sched, GstElement *element);
|
||||
void (*remove_element) (GstScheduler *sched, GstElement *element);
|
||||
|
@ -115,7 +114,6 @@ GType gst_scheduler_get_type (void);
|
|||
|
||||
|
||||
void gst_scheduler_setup (GstScheduler *sched);
|
||||
gboolean gst_scheduler_get_preferred_stack(GstScheduler *sched, gpointer *stack, gulong *size);
|
||||
void gst_scheduler_reset (GstScheduler *sched);
|
||||
void gst_scheduler_add_element (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_remove_element (GstScheduler *sched, GstElement *element);
|
||||
|
|
|
@ -64,7 +64,7 @@ struct _GstThread {
|
|||
GThread *thread_id; /* id of the thread, if any */
|
||||
int sched_policy;
|
||||
int priority;
|
||||
gpointer *stack; /* set with gst_scheduler_get_preferred_stack */
|
||||
gpointer *stack;
|
||||
guint stack_size; /* stack size */
|
||||
gint pid; /* the pid of the thread */
|
||||
gint ppid; /* the pid of the thread's parent process */
|
||||
|
|
|
@ -109,7 +109,6 @@ static void gst_basic_scheduler_init (GstBasicScheduler * scheduler);
|
|||
static void gst_basic_scheduler_dispose (GObject *object);
|
||||
|
||||
static void gst_basic_scheduler_setup (GstScheduler *sched);
|
||||
static gboolean gst_basic_scheduler_get_preferred_stack (GstScheduler *sched, gpointer *stack, gulong *size);
|
||||
static void gst_basic_scheduler_reset (GstScheduler *sched);
|
||||
static void gst_basic_scheduler_add_element (GstScheduler *sched, GstElement *element);
|
||||
static void gst_basic_scheduler_remove_element (GstScheduler *sched, GstElement *element);
|
||||
|
@ -201,7 +200,6 @@ gst_basic_scheduler_class_init (GstBasicSchedulerClass * klass)
|
|||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_basic_scheduler_dispose);
|
||||
|
||||
gstscheduler_class->setup = GST_DEBUG_FUNCPTR (gst_basic_scheduler_setup);
|
||||
gstscheduler_class->get_preferred_stack= GST_DEBUG_FUNCPTR (gst_basic_scheduler_get_preferred_stack);
|
||||
gstscheduler_class->reset = GST_DEBUG_FUNCPTR (gst_basic_scheduler_reset);
|
||||
gstscheduler_class->add_element = GST_DEBUG_FUNCPTR (gst_basic_scheduler_add_element);
|
||||
gstscheduler_class->remove_element = GST_DEBUG_FUNCPTR (gst_basic_scheduler_remove_element);
|
||||
|
@ -978,18 +976,6 @@ gst_basic_scheduler_setup (GstScheduler *sched)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_basic_scheduler_get_preferred_stack (GstScheduler *sched,
|
||||
gpointer *stack, gulong *size)
|
||||
{
|
||||
if (do_cothreads_stackquery (stack, size)) {
|
||||
GST_DEBUG (GST_CAT_SCHEDULING,
|
||||
"getting preferred stack size as %p and %lu", *stack, *size);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_basic_scheduler_reset (GstScheduler *sched)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue