/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2013-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.
#pragma once
-#include "folly/MPMCQueue.h"
+#include <folly/MPMCQueue.h>
namespace folly {
}
uint64_t blockingRead(T& elem) noexcept {
- uint64_t ticket = queue_.popTicket_++;
- queue_.dequeueWithTicket(ticket, elem);
+ uint64_t ticket;
+ queue_.blockingReadWithTicket(ticket, elem);
return ticket;
}
template <class... Args>
bool readAndGetTicket(uint64_t& ticket, T& elem) noexcept {
- if (queue_.tryObtainReadyPopTicket(ticket)) {
- queue_.dequeueWithTicket(ticket, elem);
- return true;
- } else {
- return false;
- }
+ return queue_.readAndGetTicket(ticket, elem);
}
// See MPMCQueue<T>::writeCount; only works for the first stage
AmplificationProduct<std::tuple<Ts...>>::value;
};
-}} // namespaces
-
+} // namespace detail
+} // namespace folly