mirror of
https://github.com/verilator/verilator.git
synced 2025-01-04 05:37:48 +00:00
parent
9dcb7ea6a9
commit
01dadb0a8d
@ -139,7 +139,15 @@ class V3ThreadPool final {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
if (VL_UNCOVERABLE(!m_mutex.try_lock())) {
|
||||
bool m_mutex_locked = m_mutex.try_lock();
|
||||
// try_lock can sometimes spontaneously fail even when mutex is not locked,
|
||||
// make sure this isn't the case
|
||||
for (int i = 0; i < VL_LOCK_SPINS; ++i) {
|
||||
if (VL_LIKELY(m_mutex_locked)) break;
|
||||
VL_CPU_RELAX();
|
||||
m_mutex_locked = m_mutex.try_lock();
|
||||
}
|
||||
if (VL_UNCOVERABLE(!m_mutex_locked)) {
|
||||
if (VL_UNCOVERABLE(m_jobsInProgress != 0)) {
|
||||
// ThreadPool shouldn't be destroyed when jobs are running and mutex is locked,
|
||||
// something is wrong. Most likely Verilator is exiting as a result of failed
|
||||
|
Loading…
Reference in New Issue
Block a user