diff options
Diffstat (limited to 'thrpool.c')
-rw-r--r-- | thrpool.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -93,7 +93,7 @@ static void poke(pthread_t thr, int sig) } static bool -thr_create_fail_retry(struct mog_thrpool *tp, size_t size, +thr_create_fail_retry(struct mog_thrpool *tp, unsigned size, unsigned long *nr_eagain, int err) { /* do not leave the pool w/o threads at all */ @@ -108,14 +108,14 @@ thr_create_fail_retry(struct mog_thrpool *tp, size_t size, } else { errno = err; syslog(LOG_ERR, - "pthread_create: %m, only running %lu of %lu threads", - (unsigned long)tp->n_threads, (unsigned long)size); + "pthread_create: %m, only running %u of %u threads", + tp->n_threads, size); return false; } } static bool -thrpool_add(struct mog_thrpool *tp, size_t size, unsigned long *nr_eagain) +thrpool_add(struct mog_thrpool *tp, unsigned size, unsigned long *nr_eagain) { struct mog_thr_start_arg arg = { .mtx = PTHREAD_MUTEX_INITIALIZER, @@ -158,7 +158,7 @@ thrpool_add(struct mog_thrpool *tp, size_t size, unsigned long *nr_eagain) return true; } -void mog_thrpool_set_size(struct mog_thrpool *tp, size_t size) +void mog_thrpool_set_size(struct mog_thrpool *tp, unsigned size) { unsigned long nr_eagain = 0; @@ -168,7 +168,7 @@ void mog_thrpool_set_size(struct mog_thrpool *tp, size_t size) /* nothing */; if (tp->n_threads > size) { - size_t i; + unsigned i; int err; /* set the do_quit flag for all threads we kill */ @@ -197,19 +197,19 @@ void mog_thrpool_set_size(struct mog_thrpool *tp, size_t size) } void -mog_thrpool_start(struct mog_thrpool *tp, size_t n, +mog_thrpool_start(struct mog_thrpool *tp, unsigned nthr, void *(*start_fn)(void *), void *arg) { /* we may be started on a new server before device dirs exist */ - if (n == 0) - n = 1; + if (nthr == 0) + nthr = 1; tp->threads = NULL; tp->n_threads = 0; tp->start_fn = start_fn; tp->start_arg = arg; CHECK(int, 0, pthread_mutex_init(&tp->lock, NULL)); - mog_thrpool_set_size(tp, n); + mog_thrpool_set_size(tp, nthr); } void mog_thrpool_quit(struct mog_thrpool *tp, struct mog_queue *q) |