diff options
Diffstat (limited to 'src/thread-pool.c')
-rw-r--r-- | src/thread-pool.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/thread-pool.c b/src/thread-pool.c index e8ca4d6a..0ae26e17 100644 --- a/src/thread-pool.c +++ b/src/thread-pool.c @@ -124,8 +124,6 @@ signed int get_status_label() } -/* ---------------------------- Custom get_task() --------------------------- */ - struct task_queue { pthread_mutex_t lock; @@ -203,28 +201,29 @@ static void *task_worker(void *pargsv) * @get_task: The function which will determine the next unassigned task * @final: The function which will be called to clean up after a task * @queue_args: A pointer to any data required to determine the next task - * @max: Stop calling get_task() after starting this number of jobs + * @max: Stop calling get_task after starting this number of jobs * @cpu_num: The number of CPUs in the system * @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 + * '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(). + * be passed to 'work'. * - * final() will be called once per image, and will be given both queue_args + * '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. + * 'get_task' and 'final' will be called only under lock, and so do NOT need to + * be re-entrant or otherwise thread safe. 'work', of course, needs to be + * thread safe. * - * Work will stop after 'max' tasks have been processed whether get_task() + * 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), - void *(*get_task)(void *), void (*final)(void *, void *), +int run_threads(int n_threads, TPWorkFunc work, + TPGetTaskFunc get_task, TPFinalFunc final, void *queue_args, int max, int cpu_num, int cpu_groupsize, int cpu_offset) { |