diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-04-23 16:00:56 +0200 |
---|---|---|
committer | Wim Taymans <wim@metal.(none)> | 2009-05-12 00:22:25 +0200 |
commit | 4d326be6cff7b4f193dc166a6599fc320616e04b (patch) | |
tree | 9d72f9ba2c04eb7c8ecb02db0f79e37d44aefe2a | |
parent | aadac11ae3b5ce97b4ad3efaf8eb65466663f9e1 (diff) |
taskpool: fix docs, make push/join generic
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.
-rw-r--r-- | docs/gst/gstreamer-sections.txt | 2 | ||||
-rw-r--r-- | gst/gsttaskpool.c | 20 | ||||
-rw-r--r-- | gst/gsttaskpool.h | 12 |
3 files changed, 19 insertions, 15 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 8bd2a58b76..4b4b1f94a6 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gsttaskpool.c b/gst/gsttaskpool.c index a123e253f4..12e8f4ad70 100644 --- a/gst/gsttaskpool.c +++ b/gst/gsttaskpool.c @@ -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); } diff --git a/gst/gsttaskpool.h b/gst/gsttaskpool.h index 35bb348784..ff5106b68a 100644 --- a/gst/gsttaskpool.h +++ b/gst/gsttaskpool.h @@ -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); |