Futex: ignore errors on wake
authorAnton Likhtarov <alikhtarov@fb.com>
Tue, 23 Jun 2015 02:31:17 +0000 (19:31 -0700)
committerSara Golemon <sgolemon@fb.com>
Wed, 24 Jun 2015 16:41:05 +0000 (09:41 -0700)
Summary: See the comment for details

Reviewed By: @nbronson

Differential Revision: D2181231

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;
 }