sync: run sync.pool without using concurrency features when VJOBS=1

pull/5460/head
Delyan Angelov 2020-06-22 14:21:54 +03:00
parent 640bbbae85
commit cf4dc93e02
1 changed files with 6 additions and 1 deletions

View File

@ -118,7 +118,12 @@ pub fn (mut pool PoolProcessor) work_on_pointers(items []voidptr) {
pool.thread_contexts << [voidptr(0)].repeat(pool.items.len)
pool.waitgroup.add(njobs)
for i := 0; i < njobs; i++ {
if njobs > 1 {
go process_in_thread(mut pool,i)
} else {
// do not run concurrently, just use the same thread:
process_in_thread(mut pool,i)
}
}
pool.waitgroup.wait()
}