Add asserts to prevent mysterious hangs in a non-thread-safe gmock build.
This commit is contained in:
parent
b215e30cad
commit
8209a45e24
@ -110,7 +110,12 @@ class linked_ptr_internal {
|
||||
MutexLock lock(&g_linked_ptr_mutex);
|
||||
|
||||
linked_ptr_internal const* p = ptr;
|
||||
while (p->next_ != ptr) p = p->next_;
|
||||
while (p->next_ != ptr) {
|
||||
assert(p->next_ != this &&
|
||||
"Trying to join() a linked ring we are already in. "
|
||||
"Is GMock thread safety enabled?");
|
||||
p = p->next_;
|
||||
}
|
||||
p->next_ = this;
|
||||
next_ = ptr;
|
||||
}
|
||||
@ -123,7 +128,12 @@ class linked_ptr_internal {
|
||||
|
||||
if (next_ == this) return true;
|
||||
linked_ptr_internal const* p = next_;
|
||||
while (p->next_ != this) p = p->next_;
|
||||
while (p->next_ != this) {
|
||||
assert(p->next_ != next_ &&
|
||||
"Trying to depart() a linked ring we are not in. "
|
||||
"Is GMock thread safety enabled?");
|
||||
p = p->next_;
|
||||
}
|
||||
p->next_ = next_;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user