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...
let mut lock = self.task_count.lock();
module.verify().unwrap();
f.run(&module);
let mut lock = self.task_count.lock();
*lock += 1;
self.wait_condvar.notify_all();
}