Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: base/synchronization/condition_variable_unittest.cc

Issue 9055001: Change code in base (primarily unit tests) to use Sleep(TimeDelta). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Qualify windows Sleep calls to go through PlatformThread. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/spin_wait.h ('k') | base/synchronization/lock_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Multi-threaded tests of ConditionVariable class. 5 // Multi-threaded tests of ConditionVariable class.
6 6
7 #include <time.h> 7 #include <time.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 shutdown_ = true; 654 shutdown_ = true;
655 } 655 }
656 656
657 void WorkQueue::SpinUntilAllThreadsAreWaiting() { 657 void WorkQueue::SpinUntilAllThreadsAreWaiting() {
658 while (true) { 658 while (true) {
659 { 659 {
660 base::AutoLock auto_lock(lock_); 660 base::AutoLock auto_lock(lock_);
661 if (waiting_thread_count_ == thread_count_) 661 if (waiting_thread_count_ == thread_count_)
662 break; 662 break;
663 } 663 }
664 PlatformThread::Sleep(30); 664 PlatformThread::Sleep(TimeDelta::FromMilliseconds(30));
665 } 665 }
666 } 666 }
667 667
668 void WorkQueue::SpinUntilTaskCountLessThan(int task_count) { 668 void WorkQueue::SpinUntilTaskCountLessThan(int task_count) {
669 while (true) { 669 while (true) {
670 { 670 {
671 base::AutoLock auto_lock(lock_); 671 base::AutoLock auto_lock(lock_);
672 if (task_count_ < task_count) 672 if (task_count_ < task_count)
673 break; 673 break;
674 } 674 }
675 PlatformThread::Sleep(30); 675 PlatformThread::Sleep(TimeDelta::FromMilliseconds(30));
676 } 676 }
677 } 677 }
678 678
679 679
680 //------------------------------------------------------------------------------ 680 //------------------------------------------------------------------------------
681 // Define the standard worker task. Several tests will spin out many of these 681 // Define the standard worker task. Several tests will spin out many of these
682 // threads. 682 // threads.
683 //------------------------------------------------------------------------------ 683 //------------------------------------------------------------------------------
684 684
685 // The multithread tests involve several threads with a task to perform as 685 // The multithread tests involve several threads with a task to perform as
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 base::AutoLock auto_lock(lock_); 741 base::AutoLock auto_lock(lock_);
742 // Send notification that we completed our "work." 742 // Send notification that we completed our "work."
743 WorkIsCompleted(thread_id); 743 WorkIsCompleted(thread_id);
744 } 744 }
745 } 745 }
746 } 746 }
747 747
748 } // namespace 748 } // namespace
749 749
750 } // namespace base 750 } // namespace base
OLDNEW
« no previous file with comments | « base/spin_wait.h ('k') | base/synchronization/lock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698