Chromium Code Reviews| Index: base/shared_memory_posix.cc |
| diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc |
| index 32a55e91284f21d5abc299e376dd81192f668d4e..e424ad1fcd326fc50bac46f59f58b3f410940c40 100644 |
| --- a/base/shared_memory_posix.cc |
| +++ b/base/shared_memory_posix.cc |
| @@ -11,9 +11,11 @@ |
| #include <unistd.h> |
| #include "base/file_util.h" |
| +#include "base/lazy_instance.h" |
| #include "base/logging.h" |
| #include "base/threading/platform_thread.h" |
| #include "base/safe_strerror_posix.h" |
| +#include "base/synchronization/lock.h" |
| #include "base/threading/thread_restrictions.h" |
| #include "base/utf_string_conversions.h" |
| @@ -34,6 +36,8 @@ namespace { |
| // namespaces, but who knows what's out there. |
| const char kSemaphoreSuffix[] = "-sem"; |
| +LazyInstance<Lock> g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; |
|
jar (doing other things)
2012/02/25 00:01:39
Should this be a leaky lazy instance? Are you sur
vandebo (ex-Chrome)
2012/02/25 01:50:36
Good point - The existing uses *might* be ok to us
|
| + |
| } |
| SharedMemory::SharedMemory() |
| @@ -268,11 +272,13 @@ void SharedMemory::Close() { |
| } |
| void SharedMemory::Lock() { |
| + g_thread_lock_.Get().Acquire(); |
| LockOrUnlockCommon(F_LOCK); |
| } |
| void SharedMemory::Unlock() { |
| LockOrUnlockCommon(F_ULOCK); |
| + g_thread_lock_.Get().Release(); |
| } |
| #if !defined(OS_ANDROID) |