xbps_array_foreach_cb_multi: improve previous.
Do not wait for the other threads to finish, just exit early.
This commit is contained in:
parent
08a1c61a4d
commit
a3a1c372cb
@ -152,7 +152,7 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp,
|
|||||||
|
|
||||||
if ((rv = pthread_create(&thd[i].thread, NULL, array_foreach_thread, &thd[i])) != 0) {
|
if ((rv = pthread_create(&thd[i].thread, NULL, array_foreach_thread, &thd[i])) != 0) {
|
||||||
error = rv;
|
error = rv;
|
||||||
break;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -160,6 +160,7 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp,
|
|||||||
for (int i = 0; i < maxthreads; i++)
|
for (int i = 0; i < maxthreads; i++)
|
||||||
rv = pthread_join(thd[i].thread, NULL);
|
rv = pthread_join(thd[i].thread, NULL);
|
||||||
|
|
||||||
|
out:
|
||||||
free(thd);
|
free(thd);
|
||||||
pthread_spin_destroy(&reserved_lock);
|
pthread_spin_destroy(&reserved_lock);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user