Futex: ignore errors on wake
[folly.git] / folly / detail / Futex.cpp
index f3d7bb0454ab92621b147be77f0188ae937e6a81..bef3c022bf53561fb883485951c91429e9f68c5a 100644 (file)
@@ -65,8 +65,13 @@ int nativeFutexWake(void* addr, int count, uint32_t wakeMask) {
                    nullptr, /* addr2 */
                    wakeMask); /* val3 */
 
-  assert(rv >= 0);
-
+  /* NOTE: we ignore errors on wake for the case of a futex
+     guarding its own destruction, similar to this
+     glibc bug with sem_post/sem_wait:
+     https://sourceware.org/bugzilla/show_bug.cgi?id=12674 */
+  if (rv < 0) {
+    return 0;
+  }
   return rv;
 }