Futex::futexWait returns FutexResult
[folly.git] / folly / detail / MemoryIdler.h
index 2804ffb8fe8f4aed4a11a6a37c8ed084477b06dc..caac253e014be4bd99a749f74f51a90a85daa216 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ struct MemoryIdler {
   template <
       template <typename> class Atom,
       typename Clock = std::chrono::steady_clock>
-  static bool futexWait(
+  static FutexResult futexWait(
       Futex<Atom>& fut,
       uint32_t expected,
       uint32_t waitMask = -1,
@@ -110,7 +110,6 @@ struct MemoryIdler {
           defaultIdleTimeout.load(std::memory_order_acquire),
       size_t stackToRetain = kDefaultStackToRetain,
       float timeoutVariationFrac = 0.5) {
-
     if (idleTimeout == Clock::duration::max()) {
       // no need to use futexWaitUntil if no timeout is possible
       return fut.futexWait(expected, waitMask);
@@ -128,7 +127,7 @@ struct MemoryIdler {
         // finished before timeout hit, no flush
         assert(rv == FutexResult::VALUE_CHANGED || rv == FutexResult::AWOKEN ||
                rv == FutexResult::INTERRUPTED);
-        return rv == FutexResult::AWOKEN;
+        return rv;
       }
     }