Author: [email protected]
Date: Wed Mar 18 03:48:06 2009
New Revision: 1530

Modified:
    branches/bleeding_edge/src/platform-linux.cc

Log:
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.


Modified: branches/bleeding_edge/src/platform-linux.cc
==============================================================================
--- branches/bleeding_edge/src/platform-linux.cc        (original)
+++ branches/bleeding_edge/src/platform-linux.cc        Wed Mar 18 03:48:06 2009
@@ -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