Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: src/base/platform/semaphore.cc

Issue 1407463002: Workaround for borked sem_init library function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-js-1
Patch Set: Rebased. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698