/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2016 Kern Sibbald
+ Copyright (C) 2000-2017 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
typedef struct workq_tag {
pthread_mutex_t mutex; /* queue access control */
pthread_cond_t work; /* wait for work */
+ pthread_cond_t idle; /* wait for idle */
pthread_attr_t attr; /* create detached threads */
workq_ele_t *first, *last; /* work queue */
int valid; /* queue initialized */
int max_workers; /* max threads */
int num_workers; /* current threads */
int idle_workers; /* idle threads */
+ int num_running; /* Number of jobs running */
void *(*engine)(void *arg); /* user engine */
} workq_t;
extern int workq_destroy(workq_t *wq);
extern int workq_add(workq_t *wq, void *element, workq_ele_t **work_item, int priority);
extern int workq_remove(workq_t *wq, workq_ele_t *work_item);
+extern int workq_wait_idle(workq_t *wq);
+
#endif /* __WORKQ_H */