Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
8209a45e
Commit
8209a45e
authored
Feb 14, 2015
by
kosak
Browse files
Add asserts to prevent mysterious hangs in a non-thread-safe gmock build.
parent
b215e30c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
include/gtest/internal/gtest-linked_ptr.h
include/gtest/internal/gtest-linked_ptr.h
+12
-2
No files found.
include/gtest/internal/gtest-linked_ptr.h
View file @
8209a45e
...
@@ -110,7 +110,12 @@ class linked_ptr_internal {
...
@@ -110,7 +110,12 @@ class linked_ptr_internal {
MutexLock
lock
(
&
g_linked_ptr_mutex
);
MutexLock
lock
(
&
g_linked_ptr_mutex
);
linked_ptr_internal
const
*
p
=
ptr
;
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
;
p
->
next_
=
this
;
next_
=
ptr
;
next_
=
ptr
;
}
}
...
@@ -123,7 +128,12 @@ class linked_ptr_internal {
...
@@ -123,7 +128,12 @@ class linked_ptr_internal {
if
(
next_
==
this
)
return
true
;
if
(
next_
==
this
)
return
true
;
linked_ptr_internal
const
*
p
=
next_
;
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_
;
p
->
next_
=
next_
;
return
false
;
return
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment