From 75bad6260eb43739cede7ec49964ffc7c37ecfa9 Mon Sep 17 00:00:00 2001 From: Anton Likhtarov Date: Mon, 22 Jun 2015 19:31:17 -0700 Subject: [PATCH] Futex: ignore errors on wake Summary: See the comment for details Reviewed By: @nbronson Differential Revision: D2181231 --- folly/detail/Futex.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/folly/detail/Futex.cpp b/folly/detail/Futex.cpp index f3d7bb04..bef3c022 100644 --- a/folly/detail/Futex.cpp +++ b/folly/detail/Futex.cpp @@ -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; } -- 2.34.1