taskpool: fix docs, make push/join generic
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 23 Apr 2009 14:00:56 +0000 (16:00 +0200)
committerWim Taymans <wim@metal.(none)>
Mon, 11 May 2009 22:22:25 +0000 (00:22 +0200)
Fix some more docs.
Make _push() return a generic id (this can be something else than a GThread in
some cases) and make _join() use that generic id.

docs/gst/gstreamer-sections.txt
gst/gsttaskpool.c
gst/gsttaskpool.h

index 8bd2a58..4b4b1f9 100644 (file)
@@ -2176,8 +2176,8 @@ GstTaskPoolClass
 gst_task_pool_new
 gst_task_pool_set_func
 gst_task_pool_prepare
-gst_task_pool_join
 gst_task_pool_push
+gst_task_pool_join
 gst_task_pool_cleanup
 <SUBSECTION Standard>
 GST_IS_TASK_POOL
index a123e25..12e8f4a 100644 (file)
@@ -74,7 +74,7 @@ default_cleanup (GstTaskPool * pool)
   GST_OBJECT_UNLOCK (pool);
 }
 
-static GThread *
+static gpointer
 default_push (GstTaskPool * pool, gpointer data, GError ** error)
 {
   GST_OBJECT_LOCK (pool);
@@ -86,7 +86,7 @@ default_push (GstTaskPool * pool, gpointer data, GError ** error)
 }
 
 static void
-default_join (GstTaskPool * pool, GThread * thread)
+default_join (GstTaskPool * pool, gpointer id)
 {
   /* does nothing, we can't join for threads from the threadpool */
 }
@@ -203,10 +203,11 @@ gst_task_pool_cleanup (GstTaskPool * pool)
  *
  * Start the execution of a new thread from @pool.
  *
- * Returns: a #GThread or NULL when the GThread is not yet known. You must check
- * @error to detect errors.
+ * Returns: a pointer that should be used for the gst_task_pool_join
+ * function. This pointer can be NULL, you must check @error to detect
+ * errors.
  */
-GThread *
+gpointer
 gst_task_pool_push (GstTaskPool * pool, gpointer data, GError ** error)
 {
   GstTaskPoolClass *klass;
@@ -231,12 +232,13 @@ not_supported:
 /**
  * gst_task_pool_join:
  * @pool: a #GstTaskPool
- * @thread: a #GThread
+ * @id: the id
  *
- * Join a GThread or return it to the pool.
+ * Join a task and/or return it to the pool. @id is the id obtained from 
+ * gst_task_pool_push().
  */
 void
-gst_task_pool_join (GstTaskPool * pool, GThread * thread)
+gst_task_pool_join (GstTaskPool * pool, gpointer id)
 {
   GstTaskPoolClass *klass;
 
@@ -245,5 +247,5 @@ gst_task_pool_join (GstTaskPool * pool, GThread * thread)
   klass = GST_TASK_POOL_GET_CLASS (pool);
 
   if (klass->join)
-    klass->join (pool, thread);
+    klass->join (pool, id);
 }
index 35bb348..ff5106b 100644 (file)
@@ -57,7 +57,8 @@ struct _GstTaskPool {
 
 /**
  * GstTaskPoolClass:
- * @init: initialize the threadpool
+ * @parent_class: the parent class structure
+ * @prepare: prepare the threadpool
  * @cleanup: make sure all threads are stopped
  * @push: start a new thread
  * @join: join a thread
@@ -67,12 +68,13 @@ struct _GstTaskPool {
 struct _GstTaskPoolClass {
   GstObjectClass parent_class;
 
+  /*< public >*/
   void      (*prepare)  (GstTaskPool *pool, GFunc func,
                          gpointer user_data, GError **error);
   void      (*cleanup)  (GstTaskPool *pool);
 
-  GThread * (*push)     (GstTaskPool *pool, gpointer data, GError **error);
-  void      (*join)     (GstTaskPool *pool, GThread *thread);
+  gpointer  (*push)     (GstTaskPool *pool, gpointer data, GError **error);
+  void      (*join)     (GstTaskPool *pool, gpointer id);
 
   /*< private >*/
   gpointer _gst_reserved[GST_PADDING];
@@ -87,9 +89,9 @@ void            gst_task_pool_set_func    (GstTaskPool *pool,
 
 void            gst_task_pool_prepare     (GstTaskPool *pool, GError **error);
 
-GThread *       gst_task_pool_push        (GstTaskPool *pool, gpointer data,
+gpointer        gst_task_pool_push        (GstTaskPool *pool, gpointer data,
                                            GError **error);
-void            gst_task_pool_join        (GstTaskPool *pool, GThread *thread);
+void            gst_task_pool_join        (GstTaskPool *pool, gpointer id);
 
 void           gst_task_pool_cleanup     (GstTaskPool *pool);