Removing unused code related to stack allocation (cothreads_stackquery(), gst_schedul...
authorDavid Schleef <ds@schleef.org>
Fri, 6 Dec 2002 23:05:26 +0000 (23:05 +0000)
committerDavid Schleef <ds@schleef.org>
Fri, 6 Dec 2002 23:05:26 +0000 (23:05 +0000)
Original commit message from CVS:
Removing unused code related to stack allocation (cothreads_stackquery(),
gst_scheduler_get_preferred_stack())

gst/cothreads.c
gst/cothreads.h
gst/gstscheduler.c
gst/gstscheduler.h
gst/gstthread.h
gst/schedulers/gstbasicscheduler.c

index b59d204..5e4e6eb 100644 (file)
@@ -577,57 +577,6 @@ cothread_context_get_data (cothread_state * thread, gchar * 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
  *
index b91b8ad..db1b9c4 100644 (file)
@@ -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);
index 3f4dcce..b7580f6 100644 (file)
@@ -95,27 +95,6 @@ gst_scheduler_setup (GstScheduler *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.
  *
index b5c71e0..24df48f 100644 (file)
@@ -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);
index 3d3d94e..00350ef 100644 (file)
@@ -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 */
index 12f2632..be23f9b 100644 (file)
@@ -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)
 {