Skip to content

Commit

Permalink
[core] Add a mutable qualifier to m_Mutex from SharedMutex
Browse files Browse the repository at this point in the history
Add a lock to getReaderCount
  • Loading branch information
yomnes0 committed Jul 31, 2024
1 parent 89f76fe commit edf9aa5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions srtcore/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,5 +453,6 @@ void srt::sync::SharedMutex::unlock_shared()

int srt::sync::SharedMutex::getReaderCount() const
{
ScopedLock lk(m_Mutex);
return m_iCountRead;
}
2 changes: 1 addition & 1 deletion srtcore/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ class SharedMutex
Condition m_LockWriteCond;
Condition m_LockReadCond;

Mutex m_Mutex;
mutable Mutex m_Mutex;

int m_iCountRead;
bool m_bWriterLocked;
Expand Down

0 comments on commit edf9aa5

Please sign in to comment.