/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2015-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.
* limitations under the License.
*/
-#include <gtest/gtest.h>
+#include <queue>
#include <folly/futures/Future.h>
#include <folly/io/async/EventBase.h>
-#include <folly/Baton.h>
+#include <folly/portability/GTest.h>
+#include <folly/synchronization/Baton.h>
using namespace folly;
using std::vector;
t.join();
}
}
+
+TEST(Wait, multipleWait) {
+ auto f = futures::sleep(milliseconds(100));
+ for (size_t i = 0; i < 5; ++i) {
+ EXPECT_FALSE(f.isReady());
+ f.wait(milliseconds(3));
+ }
+ EXPECT_FALSE(f.isReady());
+ f.wait();
+ EXPECT_TRUE(f.isReady());
+ f.wait();
+ EXPECT_TRUE(f.isReady());
+}