#pragma once
#include <chrono>
+#include <thread>
#include <folly/wangle/detail/State.h>
#include <folly/Baton.h>
return std::move(t.value());
});
baton.wait();
+ while (!done.isReady()) {
+ // There's a race here between the return here and the actual finishing of
+ // the future. f is completed, but the setup may not have finished on done
+ // after the baton has posted.
+ std::this_thread::yield();
+ }
return done;
}
t.value();
});
baton.wait();
+ while (!done.isReady()) {
+ // There's a race here between the return here and the actual finishing of
+ // the future. f is completed, but the setup may not have finished on done
+ // after the baton has posted.
+ std::this_thread::yield();
+ }
return done;
}