Commit ef011843 authored by Bruno Goncalves's avatar Bruno Goncalves Committed by facebook-github-bot-9

Remove boost dependency from folly/ProducerConsumerQueue.h

Summary: Boost is great, but c++11 incorporate some of their stuffs, and classes like ProducerConsumerQueue don't need it anymore.
Closes https://github.com/facebook/folly/pull/321

Reviewed By: fredemmott, yfeldblum

Differential Revision: D2519081

fb-gh-sync-id: b138a5af4662d1e7ef5e0823cf4001880ee02456
parent f640f4bb
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <stdexcept> #include <stdexcept>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <boost/noncopyable.hpp>
#include <boost/type_traits.hpp>
namespace folly { namespace folly {
...@@ -36,9 +34,12 @@ namespace folly { ...@@ -36,9 +34,12 @@ namespace folly {
* without locks. * without locks.
*/ */
template<class T> template<class T>
struct ProducerConsumerQueue : private boost::noncopyable { struct ProducerConsumerQueue {
typedef T value_type; typedef T value_type;
ProducerConsumerQueue(const ProducerConsumerQueue&) = delete;
ProducerConsumerQueue& operator = (const ProducerConsumerQueue&) = delete;
// size must be >= 2. // size must be >= 2.
// //
// Also, note that the number of usable slots in the queue at any // Also, note that the number of usable slots in the queue at any
...@@ -60,7 +61,7 @@ struct ProducerConsumerQueue : private boost::noncopyable { ...@@ -60,7 +61,7 @@ struct ProducerConsumerQueue : private boost::noncopyable {
// We need to destruct anything that may still exist in our queue. // We need to destruct anything that may still exist in our queue.
// (No real synchronization needed at destructor time: only one // (No real synchronization needed at destructor time: only one
// thread can be doing this.) // thread can be doing this.)
if (!boost::has_trivial_destructor<T>::value) { if (!std::is_trivially_destructible<T>::value) {
size_t read = readIndex_; size_t read = readIndex_;
size_t end = writeIndex_; size_t end = writeIndex_;
while (read != end) { while (read != end) {
......
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