aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent28ddf4c3e52adc77d56b0c2e1c6ee00d95cb6f4f (diff)
More thread pool documentation
Diffstat (limited to 'src')
-rw-r--r--src/thread-pool.c13
-rw-r--r--src/thread-pool.h9
2 files changed, 13 insertions, 9 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),
diff --git a/src/thread-pool.h b/src/thread-pool.h
index 9c2a86a0..eb7fb99c 100644
--- a/src/thread-pool.h
+++ b/src/thread-pool.h
@@ -23,15 +23,6 @@
extern pthread_mutex_t stderr_lock;
extern signed int get_status_label(void);
-
-/* 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(). Work will stop after 'max' tasks have been processed.
- * final() will be called once per image, and will be given both queue_args
- * and the last task pointer.
- * get_task() and final() do NOT need to be re-entrant.
- * If "max" is zero, all tasks will be processed.
- * Returns: the number of tasks processed. */
extern int run_threads(int n_threads, void (*work)(void *, int),
void *(*get_task)(void *), void (*final)(void *, void *),
void *queue_args, int max,