File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class SharedMutex {
40
40
}
41
41
bool unlock_shared () {
42
42
std::lock_guard<std::mutex> lock (m_reader_mutex);
43
+ assert (m_readers > 0 );
43
44
--m_readers;
44
45
return m_impl.unlock_shared ();
45
46
}
@@ -57,7 +58,12 @@ struct ScopedSharedMutexReader {
57
58
if (m_mutex)
58
59
m_mutex->lock_shared ();
59
60
}
60
- ScopedSharedMutexReader (const ScopedSharedMutexReader&) = default ;
61
+
62
+ ScopedSharedMutexReader (const ScopedSharedMutexReader ©)
63
+ : m_mutex(copy.m_mutex) {
64
+ if (m_mutex)
65
+ m_mutex->lock_shared ();
66
+ }
61
67
62
68
~ScopedSharedMutexReader () {
63
69
if (m_mutex)
@@ -101,9 +107,6 @@ class SwiftScratchContextReader : ScopedSharedMutexReader {
101
107
assert (m_ptr && " invalid context" );
102
108
}
103
109
104
- SwiftScratchContextReader (const SwiftScratchContextReader ©)
105
- : ScopedSharedMutexReader(copy.m_mutex), m_ptr(copy.m_ptr) {}
106
-
107
110
TypeSystemSwiftTypeRefForExpressions *get () {
108
111
assert (m_ptr && " invalid context" );
109
112
return m_ptr;
You can’t perform that action at this time.
0 commit comments