Internals: Add V3ThreadSafety (#4477)

This commit is contained in:
Kamil Rakoczy
2023-09-13 07:57:48 -04:00
committed by GitHub
parent 839a8fa4d9
commit 8bd6d7c5b1
6 changed files with 120 additions and 14 deletions
+10
View File
@@ -111,6 +111,10 @@ void V3ThreadPool::stopOtherThreads() VL_MT_SAFE_EXCLUDES(m_mutex)
--m_stoppedJobs;
}
void V3ThreadPool::selfTestMtDisabled() {
// empty
}
void V3ThreadPool::selfTest() {
V3Mutex commonMutex;
int commonValue{0};
@@ -164,4 +168,10 @@ void V3ThreadPool::selfTest() {
futuresInt.push_back(s().enqueue(forthJob));
auto result = V3ThreadPool::waitForFutures(futuresInt);
UASSERT(result.back() == 1234, "unexpected future result = " << result.back());
{
const V3MtDisabledLockGuard mtDisabler{v3MtDisabledLock()};
selfTestMtDisabled();
}
}
V3MtDisabledLock V3MtDisabledLock::s_mtDisabledLock;