From cf4dc93e02a636192584d57337a1cf8ca085a545 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 22 Jun 2020 14:21:54 +0300 Subject: [PATCH] sync: run sync.pool without using concurrency features when VJOBS=1 --- vlib/sync/pool.v | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vlib/sync/pool.v b/vlib/sync/pool.v index 6acbc33f9d..ab63474302 100644 --- a/vlib/sync/pool.v +++ b/vlib/sync/pool.v @@ -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() }