diff options
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 |