Index: src/base/platform/semaphore.cc |
diff --git a/src/base/platform/semaphore.cc b/src/base/platform/semaphore.cc |
index d5428625ba6f62231d05afe686ca65dee3b3b7c5..9e7b59a1d2cc09f16c3ef5af043fec39a67d07f1 100644 |
--- a/src/base/platform/semaphore.cc |
+++ b/src/base/platform/semaphore.cc |
@@ -75,6 +75,10 @@ bool Semaphore::WaitFor(const TimeDelta& rel_time) { |
Semaphore::Semaphore(int count) { |
DCHECK(count >= 0); |
+#if V8_LIBC_GLIBC |
+ // sem_init in glibc prior to 2.1 does not zero out semaphores. |
+ memset(&native_handle_, 0, sizeof(native_handle_)); |
+#endif |
int result = sem_init(&native_handle_, 0, count); |
DCHECK_EQ(0, result); |
USE(result); |