1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
Delyan Angelov 2020-06-22 14:21:54 +03:00
parent 640bbbae85
commit cf4dc93e02

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++ {
go process_in_thread(mut pool,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()
}