mirror of
https://github.com/verilator/verilator.git
synced 2026-08-22 05:57:29 +02:00
+9
-1
@@ -139,7 +139,15 @@ class V3ThreadPool final {
|
|||||||
std::abort();
|
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)) {
|
if (VL_UNCOVERABLE(m_jobsInProgress != 0)) {
|
||||||
// ThreadPool shouldn't be destroyed when jobs are running and mutex is locked,
|
// 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
|
// something is wrong. Most likely Verilator is exiting as a result of failed
|
||||||
|
|||||||
Reference in New Issue
Block a user