Internals: Use mutable for mutexes. No functional change.

This commit is contained in:
Wilson Snyder 2022-05-13 07:21:39 -04:00
parent 38438b3373
commit f6035447ae
5 changed files with 6 additions and 6 deletions

View File

@ -103,7 +103,7 @@ private:
using ItemList = std::deque<VerilatedCovImpItem*>; using ItemList = std::deque<VerilatedCovImpItem*>;
// MEMBERS // MEMBERS
VerilatedMutex m_mutex; // Protects all members mutable VerilatedMutex m_mutex; // Protects all members
ValueIndexMap m_valueIndexes VL_GUARDED_BY(m_mutex); // Unique arbitrary value for values ValueIndexMap m_valueIndexes VL_GUARDED_BY(m_mutex); // Unique arbitrary value for values
IndexValueMap m_indexValues VL_GUARDED_BY(m_mutex); // Unique arbitrary value for keys IndexValueMap m_indexValues VL_GUARDED_BY(m_mutex); // Unique arbitrary value for keys
ItemList m_items VL_GUARDED_BY(m_mutex); // List of all items ItemList m_items VL_GUARDED_BY(m_mutex); // List of all items

View File

@ -91,7 +91,7 @@ class VerilatedEvalMsgQueue final {
std::atomic<uint64_t> m_depth; // Current depth of queue (see comments below) std::atomic<uint64_t> m_depth; // Current depth of queue (see comments below)
VerilatedMutex m_mutex; // Mutex protecting queue mutable VerilatedMutex m_mutex; // Mutex protecting queue
VerilatedThreadQueue m_queue VL_GUARDED_BY(m_mutex); // Message queue VerilatedThreadQueue m_queue VL_GUARDED_BY(m_mutex); // Message queue
public: public:
// CONSTRUCTORS // CONSTRUCTORS

View File

@ -155,7 +155,7 @@ class VlExecutionProfiler final {
// STATE // STATE
static VL_THREAD_LOCAL ExecutionTrace t_trace; // thread-local trace buffers static VL_THREAD_LOCAL ExecutionTrace t_trace; // thread-local trace buffers
VerilatedMutex m_mutex; mutable VerilatedMutex m_mutex;
// Map from thread id to &t_trace of given thread // Map from thread id to &t_trace of given thread
std::map<uint32_t, ExecutionTrace*> m_traceps VL_GUARDED_BY(m_mutex); std::map<uint32_t, ExecutionTrace*> m_traceps VL_GUARDED_BY(m_mutex);

View File

@ -150,7 +150,7 @@ private:
}; };
// MEMBERS // MEMBERS
VerilatedMutex m_mutex; mutable VerilatedMutex m_mutex;
std::condition_variable_any m_cv; std::condition_variable_any m_cv;
// Only notify the condition_variable if the worker is waiting // Only notify the condition_variable if the worker is waiting
bool m_waiting VL_GUARDED_BY(m_mutex) = false; bool m_waiting VL_GUARDED_BY(m_mutex) = false;

View File

@ -47,7 +47,7 @@
// A simple synchronized first in first out queue // A simple synchronized first in first out queue
template <class T> class VerilatedThreadQueue final { // LCOV_EXCL_LINE // lcov bug template <class T> class VerilatedThreadQueue final { // LCOV_EXCL_LINE // lcov bug
private: private:
VerilatedMutex m_mutex; // Protects m_queue mutable VerilatedMutex m_mutex; // Protects m_queue
std::condition_variable_any m_cv; std::condition_variable_any m_cv;
std::deque<T> m_queue VL_GUARDED_BY(m_mutex); std::deque<T> m_queue VL_GUARDED_BY(m_mutex);
@ -208,7 +208,7 @@ protected:
//========================================================================= //=========================================================================
// Internals available to format specific implementations // Internals available to format specific implementations
VerilatedMutex m_mutex; // Ensure dump() etc only called from single thread mutable VerilatedMutex m_mutex; // Ensure dump() etc only called from single thread
uint32_t nextCode() const { return m_nextCode; } uint32_t nextCode() const { return m_nextCode; }
uint32_t numSignals() const { return m_numSignals; } uint32_t numSignals() const { return m_numSignals; }