aboutsummaryrefslogtreecommitdiff
path: root/src/thread-pool.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-04-07 11:19:01 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:23 +0100
commit205a0d807d9ceb028eb7c073f82ca43443f66647 (patch)
tree9823778950df45e4201a3bff45fe4bec0f64effc /src/thread-pool.c
parent28ddf4c3e52adc77d56b0c2e1c6ee00d95cb6f4f (diff)
More thread pool documentation
Diffstat (limited to 'src/thread-pool.c')
-rw-r--r--src/thread-pool.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/thread-pool.c b/src/thread-pool.c
index 4a720efc..e8ca4d6a 100644
--- a/src/thread-pool.c
+++ b/src/thread-pool.c
@@ -208,6 +208,19 @@ static void *task_worker(void *pargsv)
* @cpu_groupsize: The group size into which the CPUs are grouped
* @cpu_offset: The CPU group number at which to start pinning threads
*
+ * get_task() will be called every time a worker is idle. It returns either
+ * NULL, indicating that no further work is available, or a pointer which will
+ * be passed to work().
+ *
+ * final() will be called once per image, and will be given both queue_args
+ * and the last task pointer.
+ *
+ * get_task() and final() will be called only under lock, and so do NOT need to
+ * be re-entrant or otherwise thread safe.
+ *
+ * Work will stop after 'max' tasks have been processed whether get_task()
+ * returned NULL or not. If "max" is zero, all tasks will be processed.
+ *
* Returns: The number of tasks completed.
**/
int run_threads(int n_threads, void (*work)(void *, int),