summaryrefslogtreecommitdiffstats
path: root/base/shared_memory.h
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-25 06:28:56 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-25 06:28:56 +0000
commita0c136a0c23998b4a66679d1d8883ee057ef5060 (patch)
tree37f1ebd13d7e3ca72866aa0ff01496327b611f81 /base/shared_memory.h
parenteb2efb10f5de9dd531d8693d20474f86b9036a74 (diff)
downloadchromium_src-a0c136a0c23998b4a66679d1d8883ee057ef5060.zip
chromium_src-a0c136a0c23998b4a66679d1d8883ee057ef5060.tar.gz
chromium_src-a0c136a0c23998b4a66679d1d8883ee057ef5060.tar.bz2
Improve SharedMemory::Lock on Posix and reenable StatsTableTest.MultipleThreads
BUG=10611 TEST=NONE Review URL: http://codereview.chromium.org/9463018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123647 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory.h')
-rw-r--r--base/shared_memory.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/base/shared_memory.h b/base/shared_memory.h
index 298baa6..a5744830 100644
--- a/base/shared_memory.h
+++ b/base/shared_memory.h
@@ -8,18 +8,22 @@
#include "build/build_config.h"
+#include <string>
+
#if defined(OS_POSIX)
#include <stdio.h>
#include <sys/types.h>
#include <semaphore.h>
-#include "base/file_descriptor_posix.h"
#endif
-#include <string>
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/process.h"
+#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
+#endif
+
class FilePath;
namespace base {
@@ -201,14 +205,11 @@ class BASE_EXPORT SharedMemory {
}
// Locks the shared memory.
- // This is a cross-process lock which may be recursively
- // locked by the same thread.
- // TODO(port):
- // WARNING: on POSIX the lock only works across processes, not
- // across threads. 2 threads in the same process can both grab the
- // lock at the same time. There are several solutions for this
- // (futex, lockf+anon_semaphore) but none are both clean and common
- // across Mac and Linux.
+ //
+ // WARNING: on POSIX the memory locking primitive only works across
+ // processes, not across threads. The Lock method is not currently
+ // used in inner loops, so we protect against multiple threads in a
+ // critical section using a class global lock.
void Lock();
#if defined(OS_WIN)