1
0
forked from M-Labs/nac3

codegen: minimized lock holding time

The previous way of holding the lock would prohibit multithread code
generation for llvm
This commit is contained in:
pca006132 2021-09-16 21:36:42 +08:00
parent 180392e2ab
commit f5353419ac

View File

@ -175,9 +175,9 @@ impl WorkerRegistry {
} }
// do whatever... // do whatever...
let mut lock = self.task_count.lock();
module.verify().unwrap(); module.verify().unwrap();
f.run(&module); f.run(&module);
let mut lock = self.task_count.lock();
*lock += 1; *lock += 1;
self.wait_condvar.notify_all(); self.wait_condvar.notify_all();
} }