aboutsummaryrefslogtreecommitdiff
path: root/src/thread-pool.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-10-11 10:57:46 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:02 +0100
commita22d0dc84c4411ca1b4583ac7857d5301c690f7c (patch)
treeb7639b8813ef6c8f97160fb8d8a8391a27664eea /src/thread-pool.h
parenta7d2cab127719eeef82584664b1abbbee06656c4 (diff)
indexamajig: Use new thread pool
Diffstat (limited to 'src/thread-pool.h')
-rw-r--r--src/thread-pool.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/thread-pool.h b/src/thread-pool.h
index 3376b8fe..05e2f55a 100644
--- a/src/thread-pool.h
+++ b/src/thread-pool.h
@@ -20,7 +20,7 @@
/* work() will be called with a number and work_args. The number will be
* unique and in the range 0..n_tasks. A progress bar will be shown using
- * "text" and the progress through the tasks. */
+ * "text" and the progress through the tasks, unless "text" is NULL. */
extern void run_thread_range(int n_tasks, int n_threads, const char *text,
void (*work)(int, void *), void *work_args);
@@ -28,10 +28,14 @@ extern void run_thread_range(int n_tasks, int n_threads, const char *text,
/* 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.
- * get_task() does not need to be re-entrant.
+ * 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 *queue_args, int max);
+ void *(*get_task)(void *), void (*final)(void *, void *),
+ void *queue_args, int max);
#endif /* THREAD_POOL_H */