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

Side by Side Diff: base/shared_memory_posix.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.h ('k') | base/shared_memory_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) 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/shared_memory.h" 5 #include "base/shared_memory.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 12
13 namespace base {
14
13 namespace { 15 namespace {
14 // Paranoia. Semaphores and shared memory segments should live in different 16 // Paranoia. Semaphores and shared memory segments should live in different
15 // namespaces, but who knows what's out there. 17 // namespaces, but who knows what's out there.
16 const char kSemaphoreSuffix[] = "-sem"; 18 const char kSemaphoreSuffix[] = "-sem";
17 } 19 }
18 20
19 SharedMemory::SharedMemory() 21 SharedMemory::SharedMemory()
20 : mapped_file_(-1), 22 : mapped_file_(-1),
21 memory_(NULL), 23 memory_(NULL),
22 read_only_(false), 24 read_only_(false),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void SharedMemory::Lock() { 161 void SharedMemory::Lock() {
160 DCHECK(lock_ != NULL); 162 DCHECK(lock_ != NULL);
161 sem_wait(lock_); 163 sem_wait(lock_);
162 } 164 }
163 165
164 void SharedMemory::Unlock() { 166 void SharedMemory::Unlock() {
165 DCHECK(lock_ != NULL); 167 DCHECK(lock_ != NULL);
166 sem_post(lock_); 168 sem_post(lock_);
167 } 169 }
168 170
171 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory.h ('k') | base/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698