src_offset = sizeof(*hdr);
- if (HAVE_THREADS) {
nr_threads = git_config_get_index_threads();
/* TODO: does creating more threads than cores help? */
nr_threads = cpus;
}
+ if (!HAVE_THREADS)
+ nr_threads = 1;
+
if (nr_threads > 1) {
extension_offset = read_eoie_extension(mmap, mmap_size);
if (extension_offset) {
} else {
src_offset += load_all_cache_entries(istate, mmap, mmap_size, src_offset);
}
- } else {
- src_offset += load_all_cache_entries(istate, mmap, mmap_size, src_offset);
- }
istate->timestamp.sec = st.st_mtime;
istate->timestamp.nsec = ST_MTIME_NSEC(st);
/* if we created a thread, join it otherwise load the extensions on the primary thread */
- if (HAVE_THREADS && extension_offset) {
+ if (extension_offset) {
int ret = pthread_join(p.pthread, NULL);
if (ret)
die(_("unable to join load_index_extensions thread: %s"), strerror(ret));
- }
- if (!extension_offset) {
+ } else {
p.src_offset = src_offset;
load_index_extensions(&p);
}
if (ce_write(&c, newfd, &hdr, sizeof(hdr)) < 0)
return -1;
- if (HAVE_THREADS) {
+ if (HAVE_THREADS)
nr_threads = git_config_get_index_threads();
+ else
+ nr_threads = 1;
if (nr_threads != 1) {
int ieot_blocks, cpus;
ieot_entries = DIV_ROUND_UP(entries, ieot_blocks);
}
}
- }
offset = lseek(newfd, 0, SEEK_CUR);
if (offset < 0) {
* strip_extensions parameter as we need it when loading the shared
* index.
*/
- if (HAVE_THREADS && ieot) {
+ if (ieot) {
struct strbuf sb = STRBUF_INIT;
write_ieot_extension(&sb, ieot);