Introduce xbps_{array,pkgdb}_foreach_cb_multi() and use it where appropiate.
In some tasks the single threaded implementation outperms the multithreaded one. Use it where it really makes a difference. The _multi() routines do not spawn any thread if _SC_NPROCESSORS_ONLN == 1. Bump XBPS_API_VERSION.
This commit is contained in:
@@ -119,7 +119,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
|
||||
cbd.array = xbps_array_create();
|
||||
|
||||
allkeys = xbps_dictionary_all_keys(idx);
|
||||
rv = xbps_array_foreach_cb(xhp, allkeys, idx, idx_cleaner_cb, &cbd);
|
||||
rv = xbps_array_foreach_cb_multi(xhp, allkeys, idx, idx_cleaner_cb, &cbd);
|
||||
xbps_object_release(allkeys);
|
||||
|
||||
for (unsigned int x = 0; x < xbps_array_count(cbd.array); x++) {
|
||||
|
||||
@@ -147,7 +147,7 @@ remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
|
||||
}
|
||||
(void)closedir(dirp);
|
||||
|
||||
rv = xbps_array_foreach_cb(xhp, array, NULL, cleaner_cb, repo);
|
||||
rv = xbps_array_foreach_cb_multi(xhp, array, NULL, cleaner_cb, repo);
|
||||
xbps_repo_close(repo);
|
||||
xbps_object_release(array);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user