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

Side by Side Diff: base/shared_memory_unittest.cc

Issue 10895: Add Terminate() to the Process object, have RenderProcessHost use this to avo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « base/shared_memory_posix.cc ('k') | base/shared_memory_win.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/platform_thread.h" 6 #include "base/platform_thread.h"
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 static const int kNumThreads = 5; 10 static const int kNumThreads = 5;
11 11
12 namespace base {
13
12 namespace { 14 namespace {
13 15
14 class SharedMemoryTest : public testing::Test {
15 };
16
17 // Each thread will open the shared memory. Each thread will take a different 4 16 // Each thread will open the shared memory. Each thread will take a different 4
18 // byte int pointer, and keep changing it, with some small pauses in between. 17 // byte int pointer, and keep changing it, with some small pauses in between.
19 // Verify that each thread's value in the shared memory is always correct. 18 // Verify that each thread's value in the shared memory is always correct.
20 class MultipleThreadMain : public PlatformThread::Delegate { 19 class MultipleThreadMain : public PlatformThread::Delegate {
21 public: 20 public:
22 explicit MultipleThreadMain(int16 id) : id_(id) {} 21 explicit MultipleThreadMain(int16 id) : id_(id) {}
23 ~MultipleThreadMain() {} 22 ~MultipleThreadMain() {}
24 23
25 // PlatformThread::Delegate interface. 24 // PlatformThread::Delegate interface.
26 void ThreadMain() { 25 void ThreadMain() {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 thread_handles[index] = pth; 173 thread_handles[index] = pth;
175 } 174 }
176 175
177 // Wait for the threads to finish. 176 // Wait for the threads to finish.
178 for (int index = 0; index < kNumThreads; ++index) { 177 for (int index = 0; index < kNumThreads; ++index) {
179 PlatformThread::Join(thread_handles[index]); 178 PlatformThread::Join(thread_handles[index]);
180 delete thread_delegates[index]; 179 delete thread_delegates[index];
181 } 180 }
182 } 181 }
183 #endif 182 #endif
183
184 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory_posix.cc ('k') | base/shared_memory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698