xbps_array_foreach_cb_multi: use PTHREAD_MUTEX_INITIALIZER.
We use defaults, no need to use pthread_mutex_init().
This commit is contained in:
parent
c460df6011
commit
3eed9bca59
@ -104,7 +104,7 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp,
|
|||||||
unsigned int arraycount, slicecount;
|
unsigned int arraycount, slicecount;
|
||||||
int rv = 0, error = 0, i, maxthreads;
|
int rv = 0, error = 0, i, maxthreads;
|
||||||
unsigned int reserved;
|
unsigned int reserved;
|
||||||
pthread_mutex_t reserved_lock;
|
pthread_mutex_t reserved_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
assert(fn != NULL);
|
assert(fn != NULL);
|
||||||
|
|
||||||
@ -119,9 +119,6 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp,
|
|||||||
if (maxthreads <= 1 || arraycount <= 1) /* use single threaded routine */
|
if (maxthreads <= 1 || arraycount <= 1) /* use single threaded routine */
|
||||||
return xbps_array_foreach_cb(xhp, array, dict, fn, arg);
|
return xbps_array_foreach_cb(xhp, array, dict, fn, arg);
|
||||||
|
|
||||||
if (pthread_mutex_init(&reserved_lock, PTHREAD_PROCESS_PRIVATE) != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
thd = calloc(maxthreads, sizeof(*thd));
|
thd = calloc(maxthreads, sizeof(*thd));
|
||||||
assert(thd);
|
assert(thd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user