diff options
author | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-07-18 10:12:50 +0000 |
---|---|---|
committer | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-07-18 10:12:50 +0000 |
commit | c6176548bfae24bcd7ff110d13a7e5139ef6bdb9 (patch) | |
tree | f2a7f037472c553fec3d857a68c04ffdc629c06d | |
parent | 84649c022683027d6c1765fad1d7b447a8e8b03a (diff) | |
download | webrtc-c6176548bfae24bcd7ff110d13a7e5139ef6bdb9.tar.gz |
Sleep in ThreadTest thread functions.
Prevents busy loops that really mess up Valgrind's thread scheduling,
this brings runtimes from up to minutes down to milliseconds.
BUG=
R=henrika@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/13969004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6728 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r-- | system_wrappers/source/thread_unittest.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/system_wrappers/source/thread_unittest.cc b/system_wrappers/source/thread_unittest.cc index 25095e65..f54d065d 100644 --- a/system_wrappers/source/thread_unittest.cc +++ b/system_wrappers/source/thread_unittest.cc @@ -12,11 +12,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" +#include "webrtc/system_wrappers/interface/sleep.h" namespace webrtc { // Function that does nothing, and reports success. bool NullRunFunction(void* obj) { + SleepMs(0); // Hand over timeslice, prevents busy looping. return true; } @@ -32,6 +34,7 @@ TEST(ThreadTest, StartStop) { bool SetFlagRunFunction(void* obj) { bool* obj_as_bool = static_cast<bool*>(obj); *obj_as_bool = true; + SleepMs(0); // Hand over timeslice, prevents busy looping. return true; } |