Reviewers: Erik Corry,

Description:
Circumvent a bug in older glibc.

In glibc prior to 2.3.4 the return value from sem_timedwait is not -1
when it fails, but the actual error code.

Turned out that our ARM setup uses glibc 2.3.2.

Please review this at http://codereview.chromium.org/42325

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/platform-linux.cc


Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc       (revision 1527)
+++ src/platform-linux.cc       (working copy)
@@ -634,6 +634,11 @@
    while (true) {
      int result = sem_timedwait(&sem_, &ts);
      if (result == 0) return true;  // Successfully got semaphore.
+    if (result > 0) {
+      // For glibc prior to 2.3.4 sem_timedwait returns the error instead  
of -1.
+      errno = result;
+      result = -1;
+    }
      if (result == -1 && errno == ETIMEDOUT) return false;  // Timeout.
      CHECK(result == -1 && errno == EINTR);  // Signal caused spurious  
wakeup.
    }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to