| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/atomic_sequence_num.h" | 5 #include "base/atomic_sequence_num.h" |
| 6 #include "base/lock.h" | 6 #include "base/lock.h" |
| 7 #include "base/simple_thread.h" | 7 #include "base/simple_thread.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | |
| 10 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 namespace { | 12 namespace { |
| 14 | 13 |
| 15 class SetIntRunner : public base::DelegateSimpleThread::Delegate { | 14 class SetIntRunner : public base::DelegateSimpleThread::Delegate { |
| 16 public: | 15 public: |
| 17 SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { } | 16 SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { } |
| 18 ~SetIntRunner() { } | 17 ~SetIntRunner() { } |
| 19 | 18 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 base::WaitableEvent event(true, false); | 158 base::WaitableEvent event(true, false); |
| 160 // Changing 9 to 10, for example, would cause us JoinAll() to never return. | 159 // Changing 9 to 10, for example, would cause us JoinAll() to never return. |
| 161 VerifyPoolRunner verifier(&seq2, 9, &event); | 160 VerifyPoolRunner verifier(&seq2, 9, &event); |
| 162 pool.Start(); | 161 pool.Start(); |
| 163 | 162 |
| 164 pool.AddWork(&verifier, 10); | 163 pool.AddWork(&verifier, 10); |
| 165 | 164 |
| 166 pool.JoinAll(); | 165 pool.JoinAll(); |
| 167 EXPECT_EQ(seq2.GetNext(), 10); | 166 EXPECT_EQ(seq2.GetNext(), 10); |
| 168 } | 167 } |
| OLD | NEW |