Commit 91ef8d68 authored by condy's avatar condy Committed by Facebook GitHub Bot

Direct initialize semaphoreWaiter (#1554)

Summary:
Before this patch, it relies on the c++17 guaranteed copy elision, since `SemaphoreBase::Waiter` is NOT copy constructible due to `std::atomic<intptr_t>`.

This patch makes it compile even using `-std=c++14`.

Pull Request resolved: https://github.com/facebook/folly/pull/1554

Differential Revision: D27505938

Pulled By: yfeldblum

fbshipit-source-id: 6c26f82f77a24236a1233cff7921cd6b9f53bd09
parent 2fd1e607
...@@ -167,8 +167,7 @@ namespace { ...@@ -167,8 +167,7 @@ namespace {
class FutureWaiter final : public fibers::Baton::Waiter { class FutureWaiter final : public fibers::Baton::Waiter {
public: public:
explicit FutureWaiter(int64_t tokens) explicit FutureWaiter(int64_t tokens) : semaphoreWaiter(tokens) {
: semaphoreWaiter(SemaphoreBase::Waiter(tokens)) {
semaphoreWaiter.baton.setWaiter(*this); semaphoreWaiter.baton.setWaiter(*this);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment