diff options
author | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 19:51:24 +0000 |
---|---|---|
committer | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 19:51:24 +0000 |
commit | 104b62b9e97c44388a2094235e471f894b94ee39 (patch) | |
tree | 9b760a99620257f48d5c675f801b4c0fb250b241 /base/shared_memory_posix.cc | |
parent | 950a2768053d4ce9420c13fb0e04ffaa7fa2d3d9 (diff) | |
download | chromium_src-104b62b9e97c44388a2094235e471f894b94ee39.zip chromium_src-104b62b9e97c44388a2094235e471f894b94ee39.tar.gz chromium_src-104b62b9e97c44388a2094235e471f894b94ee39.tar.bz2 |
We need to loop on waiting as there are plenty of reasons why it might not take.
Review URL: http://codereview.chromium.org/14002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 6731f68..a1193aa 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -4,6 +4,7 @@ #include "base/shared_memory.h" +#include <errno.h> #include <fcntl.h> #include <sys/mman.h> @@ -163,12 +164,15 @@ void SharedMemory::Close() { void SharedMemory::Lock() { DCHECK(lock_ != NULL); - sem_wait(lock_); + while(sem_wait(lock_) < 0) { + DCHECK(errno == EAGAIN || errno == EINTR); + } } void SharedMemory::Unlock() { DCHECK(lock_ != NULL); - sem_post(lock_); + int result = sem_post(lock_); + DCHECK(result == 0); } } // namespace base |