Commit eba1ff75 authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Replace boost::noncopyable with deleted copy constructors

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

Reviewed By: lbrandy

Differential Revision: D14019229

Pulled By: yfeldblum

fbshipit-source-id: dd07d567a7f176a3bb0e18f7a19c3babfe2d431d
parent 56051aed
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <cstddef> #include <cstddef>
#include <limits> #include <limits>
#include <boost/noncopyable.hpp>
#include <folly/Portability.h> #include <folly/Portability.h>
namespace folly { namespace folly {
...@@ -32,13 +30,16 @@ namespace folly { ...@@ -32,13 +30,16 @@ namespace folly {
* An atomic bitset of fixed size (specified at compile time). * An atomic bitset of fixed size (specified at compile time).
*/ */
template <size_t N> template <size_t N>
class AtomicBitSet : private boost::noncopyable { class AtomicBitSet {
public: public:
/** /**
* Construct an AtomicBitSet; all bits are initially false. * Construct an AtomicBitSet; all bits are initially false.
*/ */
AtomicBitSet(); AtomicBitSet();
AtomicBitSet(const AtomicBitSet&) = delete;
AtomicBitSet& operator=(const AtomicBitSet&) = delete;
/** /**
* Set bit idx to true, using the given memory order. Returns the * Set bit idx to true, using the given memory order. Returns the
* previous value of the bit. * previous value of the bit.
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <atomic> #include <atomic>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/noncopyable.hpp>
#include <folly/ThreadCachedInt.h> #include <folly/ThreadCachedInt.h>
#include <folly/Utility.h> #include <folly/Utility.h>
...@@ -102,7 +101,7 @@ template < ...@@ -102,7 +101,7 @@ template <
class Allocator = std::allocator<char>, class Allocator = std::allocator<char>,
class ProbeFcn = AtomicHashArrayLinearProbeFcn, class ProbeFcn = AtomicHashArrayLinearProbeFcn,
class KeyConvertFcn = Identity> class KeyConvertFcn = Identity>
class AtomicHashArray : boost::noncopyable { class AtomicHashArray {
static_assert( static_assert(
(std::is_convertible<KeyT, int32_t>::value || (std::is_convertible<KeyT, int32_t>::value ||
std::is_convertible<KeyT, int64_t>::value || std::is_convertible<KeyT, int64_t>::value ||
...@@ -422,6 +421,9 @@ class AtomicHashArray : boost::noncopyable { ...@@ -422,6 +421,9 @@ class AtomicHashArray : boost::noncopyable {
double maxLoadFactor, double maxLoadFactor,
uint32_t cacheSize); uint32_t cacheSize);
AtomicHashArray(const AtomicHashArray&) = delete;
AtomicHashArray& operator=(const AtomicHashArray&) = delete;
~AtomicHashArray() = default; ~AtomicHashArray() = default;
inline void unlockCell(value_type* const cell, KeyT newKey) { inline void unlockCell(value_type* const cell, KeyT newKey) {
......
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#define FOLLY_ATOMICHASHMAP_H_ #define FOLLY_ATOMICHASHMAP_H_
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/noncopyable.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <atomic> #include <atomic>
...@@ -162,7 +161,7 @@ template < ...@@ -162,7 +161,7 @@ template <
class Allocator, class Allocator,
class ProbeFcn, class ProbeFcn,
class KeyConvertFcn> class KeyConvertFcn>
class AtomicHashMap : boost::noncopyable { class AtomicHashMap {
typedef AtomicHashArray< typedef AtomicHashArray<
KeyT, KeyT,
ValueT, ValueT,
...@@ -206,6 +205,9 @@ class AtomicHashMap : boost::noncopyable { ...@@ -206,6 +205,9 @@ class AtomicHashMap : boost::noncopyable {
// and a Config object to specify more advanced options. // and a Config object to specify more advanced options.
explicit AtomicHashMap(size_t finalSizeEst, const Config& c = Config()); explicit AtomicHashMap(size_t finalSizeEst, const Config& c = Config());
AtomicHashMap(const AtomicHashMap&) = delete;
AtomicHashMap& operator=(const AtomicHashMap&) = delete;
~AtomicHashMap() { ~AtomicHashMap() {
const unsigned int numMaps = const unsigned int numMaps =
numMapsAllocated_.load(std::memory_order_relaxed); numMapsAllocated_.load(std::memory_order_relaxed);
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <type_traits> #include <type_traits>
#include <vector> #include <vector>
#include <boost/noncopyable.hpp>
#include <boost/random.hpp> #include <boost/random.hpp>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <glog/logging.h> #include <glog/logging.h>
...@@ -43,7 +42,7 @@ template <typename ValT, typename NodeT> ...@@ -43,7 +42,7 @@ template <typename ValT, typename NodeT>
class csl_iterator; class csl_iterator;
template <typename T> template <typename T>
class SkipListNode : private boost::noncopyable { class SkipListNode {
enum : uint16_t { enum : uint16_t {
IS_HEAD_NODE = 1, IS_HEAD_NODE = 1,
MARKED_FOR_REMOVAL = (1 << 1), MARKED_FOR_REMOVAL = (1 << 1),
...@@ -53,6 +52,9 @@ class SkipListNode : private boost::noncopyable { ...@@ -53,6 +52,9 @@ class SkipListNode : private boost::noncopyable {
public: public:
typedef T value_type; typedef T value_type;
SkipListNode(const SkipListNode&) = delete;
SkipListNode& operator=(const SkipListNode&) = delete;
template < template <
typename NodeAlloc, typename NodeAlloc,
typename U, typename U,
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <type_traits> #include <type_traits>
#include <boost/noncopyable.hpp>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/concurrency/CacheLocality.h> #include <folly/concurrency/CacheLocality.h>
#include <folly/portability/SysMman.h> #include <folly/portability/SysMman.h>
...@@ -156,12 +155,15 @@ template < ...@@ -156,12 +155,15 @@ template <
uint32_t LocalListLimit_ = 200, uint32_t LocalListLimit_ = 200,
template <typename> class Atom = std::atomic, template <typename> class Atom = std::atomic,
typename Traits = IndexedMemPoolTraits<T>> typename Traits = IndexedMemPoolTraits<T>>
struct IndexedMemPool : boost::noncopyable { struct IndexedMemPool {
typedef T value_type; typedef T value_type;
typedef std::unique_ptr<T, detail::IndexedMemPoolRecycler<IndexedMemPool>> typedef std::unique_ptr<T, detail::IndexedMemPoolRecycler<IndexedMemPool>>
UniquePtr; UniquePtr;
IndexedMemPool(const IndexedMemPool&) = delete;
IndexedMemPool& operator=(const IndexedMemPool&) = delete;
static_assert(LocalListLimit_ <= 255, "LocalListLimit must fit in 8 bits"); static_assert(LocalListLimit_ <= 255, "LocalListLimit must fit in 8 bits");
enum { enum {
NumLocalLists = NumLocalLists_, NumLocalLists = NumLocalLists_,
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
#include <boost/noncopyable.hpp>
#include <folly/Traits.h> #include <folly/Traits.h>
#include <folly/concurrency/CacheLocality.h> #include <folly/concurrency/CacheLocality.h>
#include <folly/detail/TurnSequencer.h> #include <folly/detail/TurnSequencer.h>
...@@ -640,7 +638,7 @@ template < ...@@ -640,7 +638,7 @@ template <
typename T, typename T,
template <typename> class Atom, template <typename> class Atom,
bool Dynamic> bool Dynamic>
class MPMCQueueBase<Derived<T, Atom, Dynamic>> : boost::noncopyable { class MPMCQueueBase<Derived<T, Atom, Dynamic>> {
// Note: Using CRTP static casts in several functions of this base // Note: Using CRTP static casts in several functions of this base
// template instead of making called functions virtual or duplicating // template instead of making called functions virtual or duplicating
// the code of calling functions in the derived partially specialized // the code of calling functions in the derived partially specialized
...@@ -733,6 +731,9 @@ class MPMCQueueBase<Derived<T, Atom, Dynamic>> : boost::noncopyable { ...@@ -733,6 +731,9 @@ class MPMCQueueBase<Derived<T, Atom, Dynamic>> : boost::noncopyable {
return *this; return *this;
} }
MPMCQueueBase(const MPMCQueueBase&) = delete;
MPMCQueueBase& operator=(const MPMCQueueBase&) = delete;
/// MPMCQueue can only be safely destroyed when there are no /// MPMCQueue can only be safely destroyed when there are no
/// pending enqueuers or dequeuers (this is not checked). /// pending enqueuers or dequeuers (this is not checked).
~MPMCQueueBase() { ~MPMCQueueBase() {
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include <type_traits> #include <type_traits>
#include <boost/noncopyable.hpp>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/synchronization/SmallLocks.h> #include <folly/synchronization/SmallLocks.h>
...@@ -61,13 +59,17 @@ class SpinLock { ...@@ -61,13 +59,17 @@ class SpinLock {
}; };
template <typename LOCK> template <typename LOCK>
class SpinLockGuardImpl : private boost::noncopyable { class SpinLockGuardImpl {
public: public:
FOLLY_ALWAYS_INLINE explicit SpinLockGuardImpl(LOCK& lock) noexcept( FOLLY_ALWAYS_INLINE explicit SpinLockGuardImpl(LOCK& lock) noexcept(
noexcept(lock.lock())) noexcept(lock.lock()))
: lock_(lock) { : lock_(lock) {
lock_.lock(); lock_.lock();
} }
SpinLockGuardImpl(const SpinLockGuardImpl&) = delete;
SpinLockGuardImpl& operator=(const SpinLockGuardImpl&) = delete;
FOLLY_ALWAYS_INLINE ~SpinLockGuardImpl() { FOLLY_ALWAYS_INLINE ~SpinLockGuardImpl() {
lock_.unlock(); lock_.unlock();
} }
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <atomic> #include <atomic>
#include <boost/noncopyable.hpp>
#include <folly/Likely.h> #include <folly/Likely.h>
#include <folly/ThreadLocal.h> #include <folly/ThreadLocal.h>
...@@ -36,13 +34,16 @@ namespace folly { ...@@ -36,13 +34,16 @@ namespace folly {
// ThreadCachedInt's you should considering breaking up the Tag space even // ThreadCachedInt's you should considering breaking up the Tag space even
// further. // further.
template <class IntT, class Tag = IntT> template <class IntT, class Tag = IntT>
class ThreadCachedInt : boost::noncopyable { class ThreadCachedInt {
struct IntCache; struct IntCache;
public: public:
explicit ThreadCachedInt(IntT initialVal = 0, uint32_t cacheSize = 1000) explicit ThreadCachedInt(IntT initialVal = 0, uint32_t cacheSize = 1000)
: target_(initialVal), cacheSize_(cacheSize) {} : target_(initialVal), cacheSize_(cacheSize) {}
ThreadCachedInt(const ThreadCachedInt&) = delete;
ThreadCachedInt& operator=(const ThreadCachedInt&) = delete;
void increment(IntT inc) { void increment(IntT inc) {
auto cache = cache_.get(); auto cache = cache_.get();
if (UNLIKELY(cache == nullptr)) { if (UNLIKELY(cache == nullptr)) {
......
...@@ -98,7 +98,6 @@ class TimeoutQueue { ...@@ -98,7 +98,6 @@ class TimeoutQueue {
private: private:
int64_t runInternal(int64_t now, bool runOnce); int64_t runInternal(int64_t now, bool runOnce);
// noncopyable
TimeoutQueue(const TimeoutQueue&) = delete; TimeoutQueue(const TimeoutQueue&) = delete;
TimeoutQueue& operator=(const TimeoutQueue&) = delete; TimeoutQueue& operator=(const TimeoutQueue&) = delete;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include <boost/noncopyable.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/Random.h> #include <folly/Random.h>
...@@ -48,8 +47,10 @@ namespace folly { ...@@ -48,8 +47,10 @@ namespace folly {
namespace io { namespace io {
namespace test { namespace test {
class DataHolder : private boost::noncopyable { class DataHolder {
public: public:
DataHolder(const DataHolder&) = delete;
DataHolder& operator=(const DataHolder&) = delete;
uint64_t hash(size_t size) const; uint64_t hash(size_t size) const;
ByteRange data(size_t size) const; ByteRange data(size_t size) const;
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <boost/noncopyable.hpp>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/Traits.h> #include <folly/Traits.h>
#include <folly/detail/TurnSequencer.h> #include <folly/detail/TurnSequencer.h>
...@@ -56,7 +54,7 @@ class RingBufferSlot; ...@@ -56,7 +54,7 @@ class RingBufferSlot;
/// ///
template <typename T, template <typename> class Atom = std::atomic> template <typename T, template <typename> class Atom = std::atomic>
class LockFreeRingBuffer : boost::noncopyable { class LockFreeRingBuffer {
static_assert( static_assert(
std::is_nothrow_default_constructible<T>::value, std::is_nothrow_default_constructible<T>::value,
"Element type must be nothrow default constructible"); "Element type must be nothrow default constructible");
...@@ -101,6 +99,9 @@ class LockFreeRingBuffer : boost::noncopyable { ...@@ -101,6 +99,9 @@ class LockFreeRingBuffer : boost::noncopyable {
slots_(new detail::RingBufferSlot<T, Atom>[capacity]), slots_(new detail::RingBufferSlot<T, Atom>[capacity]),
ticket_(0) {} ticket_(0) {}
LockFreeRingBuffer(const LockFreeRingBuffer&) = delete;
LockFreeRingBuffer& operator=(const LockFreeRingBuffer&) = delete;
/// Perform a single write of an object of type T. /// Perform a single write of an object of type T.
/// Writes can block iff a previous writer has not yet completed a write /// Writes can block iff a previous writer has not yet completed a write
/// for the same slot (before the most recent wrap-around). /// for the same slot (before the most recent wrap-around).
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/noncopyable.hpp>
#include <libaio.h> #include <libaio.h>
#include <folly/Portability.h> #include <folly/Portability.h>
...@@ -42,7 +41,7 @@ namespace folly { ...@@ -42,7 +41,7 @@ namespace folly {
* *
* The op must remain allocated until it is completed or canceled. * The op must remain allocated until it is completed or canceled.
*/ */
class AsyncIOOp : private boost::noncopyable { class AsyncIOOp {
friend class AsyncIO; friend class AsyncIO;
friend std::ostream& operator<<(std::ostream& stream, const AsyncIOOp& o); friend std::ostream& operator<<(std::ostream& stream, const AsyncIOOp& o);
...@@ -50,6 +49,8 @@ class AsyncIOOp : private boost::noncopyable { ...@@ -50,6 +49,8 @@ class AsyncIOOp : private boost::noncopyable {
typedef std::function<void(AsyncIOOp*)> NotificationCallback; typedef std::function<void(AsyncIOOp*)> NotificationCallback;
explicit AsyncIOOp(NotificationCallback cb = NotificationCallback()); explicit AsyncIOOp(NotificationCallback cb = NotificationCallback());
AsyncIOOp(const AsyncIOOp&) = delete;
AsyncIOOp& operator=(const AsyncIOOp&) = delete;
~AsyncIOOp(); ~AsyncIOOp();
enum class State { enum class State {
...@@ -122,7 +123,7 @@ std::ostream& operator<<(std::ostream& stream, AsyncIOOp::State state); ...@@ -122,7 +123,7 @@ std::ostream& operator<<(std::ostream& stream, AsyncIOOp::State state);
/** /**
* C++ interface around Linux Async IO. * C++ interface around Linux Async IO.
*/ */
class AsyncIO : private boost::noncopyable { class AsyncIO {
public: public:
typedef AsyncIOOp Op; typedef AsyncIOOp Op;
...@@ -152,6 +153,8 @@ class AsyncIO : private boost::noncopyable { ...@@ -152,6 +153,8 @@ class AsyncIO : private boost::noncopyable {
* of the current number of pending requests. * of the current number of pending requests.
*/ */
explicit AsyncIO(size_t capacity, PollMode pollMode = NOT_POLLABLE); explicit AsyncIO(size_t capacity, PollMode pollMode = NOT_POLLABLE);
AsyncIO(const AsyncIO&) = delete;
AsyncIO& operator=(const AsyncIO&) = delete;
~AsyncIO(); ~AsyncIO();
/** /**
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include <cstddef> #include <cstddef>
#include <boost/noncopyable.hpp>
#include <folly/Range.h> #include <folly/Range.h>
namespace folly { namespace folly {
...@@ -28,7 +26,7 @@ namespace symbolizer { ...@@ -28,7 +26,7 @@ namespace symbolizer {
/** /**
* Async-signal-safe line reader. * Async-signal-safe line reader.
*/ */
class LineReader : private boost::noncopyable { class LineReader {
public: public:
/** /**
* Create a line reader that reads into a user-provided buffer (of size * Create a line reader that reads into a user-provided buffer (of size
...@@ -36,6 +34,9 @@ class LineReader : private boost::noncopyable { ...@@ -36,6 +34,9 @@ class LineReader : private boost::noncopyable {
*/ */
LineReader(int fd, char* buf, size_t bufSize); LineReader(int fd, char* buf, size_t bufSize);
LineReader(const LineReader&) = delete;
LineReader& operator=(const LineReader&) = delete;
enum State { enum State {
kReading, kReading,
kEof, kEof,
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
#include <boost/noncopyable.hpp>
#include <folly/File.h> #include <folly/File.h>
#include <folly/net/NetworkSocket.h> #include <folly/net/NetworkSocket.h>
...@@ -30,7 +28,7 @@ namespace folly { ...@@ -30,7 +28,7 @@ namespace folly {
/** /**
* Set of sockets that allows immediate, take-no-prisoners abort. * Set of sockets that allows immediate, take-no-prisoners abort.
*/ */
class ShutdownSocketSet : private boost::noncopyable { class ShutdownSocketSet {
public: public:
/** /**
* Create a socket set that can handle file descriptors < maxFd. * Create a socket set that can handle file descriptors < maxFd.
...@@ -40,6 +38,9 @@ class ShutdownSocketSet : private boost::noncopyable { ...@@ -40,6 +38,9 @@ class ShutdownSocketSet : private boost::noncopyable {
*/ */
explicit ShutdownSocketSet(int maxFd = 1 << 18); explicit ShutdownSocketSet(int maxFd = 1 << 18);
ShutdownSocketSet(const ShutdownSocketSet&) = delete;
ShutdownSocketSet& operator=(const ShutdownSocketSet&) = delete;
/** /**
* Add an already open socket to the list of sockets managed by * Add an already open socket to the list of sockets managed by
* ShutdownSocketSet. You MUST close the socket by calling * ShutdownSocketSet. You MUST close the socket by calling
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <folly/portability/Event.h> #include <folly/portability/Event.h>
#include <boost/noncopyable.hpp>
#include <memory> #include <memory>
#include <utility> #include <utility>
...@@ -32,7 +31,7 @@ class RequestContext; ...@@ -32,7 +31,7 @@ class RequestContext;
/** /**
* AsyncTimeout is used to asynchronously wait for a timeout to occur. * AsyncTimeout is used to asynchronously wait for a timeout to occur.
*/ */
class AsyncTimeout : private boost::noncopyable { class AsyncTimeout {
public: public:
typedef TimeoutManager::InternalEnum InternalEnum; typedef TimeoutManager::InternalEnum InternalEnum;
...@@ -66,6 +65,9 @@ class AsyncTimeout : private boost::noncopyable { ...@@ -66,6 +65,9 @@ class AsyncTimeout : private boost::noncopyable {
*/ */
AsyncTimeout(); AsyncTimeout();
AsyncTimeout(const AsyncTimeout&) = delete;
AsyncTimeout& operator=(const AsyncTimeout&) = delete;
/** /**
* AsyncTimeout destructor. * AsyncTimeout destructor.
* *
......
...@@ -125,8 +125,7 @@ class VirtualEventBase; ...@@ -125,8 +125,7 @@ class VirtualEventBase;
* EventBase from other threads. When it is safe to call a method from * EventBase from other threads. When it is safe to call a method from
* another thread it is explicitly listed in the method comments. * another thread it is explicitly listed in the method comments.
*/ */
class EventBase : private boost::noncopyable, class EventBase : public TimeoutManager,
public TimeoutManager,
public DrivableExecutor, public DrivableExecutor,
public IOExecutor, public IOExecutor,
public SequencedExecutor, public SequencedExecutor,
...@@ -293,6 +292,9 @@ class EventBase : private boost::noncopyable, ...@@ -293,6 +292,9 @@ class EventBase : private boost::noncopyable,
*/ */
explicit EventBase(bool enableTimeMeasurement); explicit EventBase(bool enableTimeMeasurement);
EventBase(const EventBase&) = delete;
EventBase& operator=(const EventBase&) = delete;
/** /**
* Create a new EventBase object that will use the specified libevent * Create a new EventBase object that will use the specified libevent
* event_base object to drive the event loop. * event_base object to drive the event loop.
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <folly/Synchronized.h> #include <folly/Synchronized.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <memory> #include <memory>
...@@ -28,9 +27,11 @@ namespace folly { ...@@ -28,9 +27,11 @@ namespace folly {
namespace detail { namespace detail {
class EventBaseLocalBase : public EventBaseLocalBaseBase, boost::noncopyable { class EventBaseLocalBase : public EventBaseLocalBaseBase {
public: public:
EventBaseLocalBase() {} EventBaseLocalBase() {}
EventBaseLocalBase(const EventBaseLocalBase&) = delete;
EventBaseLocalBase& operator=(const EventBaseLocalBase&) = delete;
~EventBaseLocalBase() override; ~EventBaseLocalBase() override;
void erase(EventBase& evb); void erase(EventBase& evb);
void onEventBaseDestruction(EventBase& evb) override; void onEventBaseDestruction(EventBase& evb) override;
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <cstddef> #include <cstddef>
#include <boost/noncopyable.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/io/async/EventUtil.h> #include <folly/io/async/EventUtil.h>
...@@ -36,7 +35,7 @@ class EventBase; ...@@ -36,7 +35,7 @@ class EventBase;
* Users that wish to wait on I/O events should derive from EventHandler and * Users that wish to wait on I/O events should derive from EventHandler and
* implement the handlerReady() method. * implement the handlerReady() method.
*/ */
class EventHandler : private boost::noncopyable { class EventHandler {
public: public:
enum EventFlags { enum EventFlags {
NONE = 0, NONE = 0,
...@@ -68,6 +67,9 @@ class EventHandler : private boost::noncopyable { ...@@ -68,6 +67,9 @@ class EventHandler : private boost::noncopyable {
EventBase* eventBase = nullptr, EventBase* eventBase = nullptr,
NetworkSocket fd = NetworkSocket()); NetworkSocket fd = NetworkSocket());
EventHandler(const EventHandler&) = delete;
EventHandler& operator=(const EventHandler&) = delete;
/** /**
* EventHandler destructor. * EventHandler destructor.
* *
......
...@@ -368,7 +368,7 @@ void MemoryMapping::advise(int advice, size_t offset, size_t length) const { ...@@ -368,7 +368,7 @@ void MemoryMapping::advise(int advice, size_t offset, size_t length) const {
PLOG_IF(WARNING, ::madvise(mapStart, length, advice)) << "madvise"; PLOG_IF(WARNING, ::madvise(mapStart, length, advice)) << "madvise";
} }
MemoryMapping& MemoryMapping::operator=(MemoryMapping other) { MemoryMapping& MemoryMapping::operator=(MemoryMapping&& other) {
swap(other); swap(other);
return *this; return *this;
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/File.h> #include <folly/File.h>
...@@ -29,7 +28,7 @@ namespace folly { ...@@ -29,7 +28,7 @@ namespace folly {
* *
* @author Tudor Bosman (tudorb@fb.com) * @author Tudor Bosman (tudorb@fb.com)
*/ */
class MemoryMapping : boost::noncopyable { class MemoryMapping {
public: public:
/** /**
* Lock the pages in memory? * Lock the pages in memory?
...@@ -147,11 +146,13 @@ class MemoryMapping : boost::noncopyable { ...@@ -147,11 +146,13 @@ class MemoryMapping : boost::noncopyable {
off_t length = -1, off_t length = -1,
Options options = Options()); Options options = Options());
MemoryMapping(const MemoryMapping&) = delete;
MemoryMapping(MemoryMapping&&) noexcept; MemoryMapping(MemoryMapping&&) noexcept;
~MemoryMapping(); ~MemoryMapping();
MemoryMapping& operator=(MemoryMapping); MemoryMapping& operator=(const MemoryMapping&) = delete;
MemoryMapping& operator=(MemoryMapping&&);
void swap(MemoryMapping& other) noexcept; void swap(MemoryMapping& other) noexcept;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#pragma once #pragma once
#include <assert.h> #include <assert.h>
#include <boost/noncopyable.hpp>
#include <errno.h> #include <errno.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <atomic> #include <atomic>
...@@ -144,7 +143,7 @@ class ThreadSyncVar { ...@@ -144,7 +143,7 @@ class ThreadSyncVar {
* Invocations of the scheduler function will be serialized, but will * Invocations of the scheduler function will be serialized, but will
* occur from multiple threads. A good starting schedule is uniform(0). * occur from multiple threads. A good starting schedule is uniform(0).
*/ */
class DeterministicSchedule : boost::noncopyable { class DeterministicSchedule {
public: public:
/** /**
* Arranges for the current thread (and all threads created by * Arranges for the current thread (and all threads created by
...@@ -154,6 +153,9 @@ class DeterministicSchedule : boost::noncopyable { ...@@ -154,6 +153,9 @@ class DeterministicSchedule : boost::noncopyable {
explicit DeterministicSchedule( explicit DeterministicSchedule(
const std::function<size_t(size_t)>& scheduler); const std::function<size_t(size_t)>& scheduler);
DeterministicSchedule(const DeterministicSchedule&) = delete;
DeterministicSchedule& operator=(const DeterministicSchedule&) = delete;
/** Completes the schedule. */ /** Completes the schedule. */
~DeterministicSchedule(); ~DeterministicSchedule();
......
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