xbps_array_foreach_cb_multi: use PTHREAD_MUTEX_INITIALIZER.

We use defaults, no need to use pthread_mutex_init().
This commit is contained in:
Juan RP 2020-02-10 09:14:50 +01:00
parent c460df6011
commit 3eed9bca59
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368

View File

@ -104,7 +104,7 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp,
unsigned int arraycount, slicecount;
int rv = 0, error = 0, i, maxthreads;
unsigned int reserved;
pthread_mutex_t reserved_lock;
pthread_mutex_t reserved_lock = PTHREAD_MUTEX_INITIALIZER;
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 */
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));
assert(thd);