diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-10-10 20:32:41 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:02 +0100 |
commit | 33d4fbfbbee784f734632e543a75222f38bc807d (patch) | |
tree | c9281f611a9da26433e4c3770ffce440ef25d3f9 /src/thread-pool.h | |
parent | a9adbc73158e8f8b225cd59d62ad5ade648c8241 (diff) |
calibrate_detecotr: Use new thread pool
Diffstat (limited to 'src/thread-pool.h')
-rw-r--r-- | src/thread-pool.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/thread-pool.h b/src/thread-pool.h index 4439f970..11123493 100644 --- a/src/thread-pool.h +++ b/src/thread-pool.h @@ -18,8 +18,20 @@ #endif -extern void munch_threads(int n_tasks, int n_threads, const char *text, - void (*work)(int, void *), void *work_args); +/* 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. */ +extern void run_thread_range(int n_tasks, int n_threads, const char *text, + void (*work)(int, void *), void *work_args); + + +/* 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. + * Returns: the number of tasks processed. */ +extern int run_threads(int n_threads, void (*work)(void *), + void *(*get_task)(void *), void *queue_args, int max); #endif /* THREAD_POOL_H */ |