From bb7d2e02389ad07f0e0eed82501e2c5152ea47ee Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Fri, 14 Aug 2015 11:56:32 -0700 Subject: [PATCH] Remove dep on boost_thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Summary: Remove recently introduced dependency on boost_thread by breaking EventBaseLocal off to its own rule Introduced in D2203063 Reviewed By: @​mzlee Differential Revision: D2301943 --- folly/io/async/EventBase.cpp | 3 --- folly/io/async/EventBase.h | 12 +++++++----- folly/io/async/EventBaseLocal.cpp | 4 ---- folly/io/async/EventBaseLocal.h | 8 ++------ 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp index 1f23b2b6..0bf7951f 100644 --- a/folly/io/async/EventBase.cpp +++ b/folly/io/async/EventBase.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -239,14 +238,12 @@ EventBase::~EventBase() { event_base_free(evb_); } -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__APPLE__) { std::lock_guard lock(localStorageMutex_); for (auto storage : localStorageToDtor_) { storage->onEventBaseDestruction(*this); } } -#endif VLOG(5) << "EventBase(): Destroyed."; } diff --git a/folly/io/async/EventBase.h b/folly/io/async/EventBase.h index e15465c9..908aa6af 100644 --- a/folly/io/async/EventBase.h +++ b/folly/io/async/EventBase.h @@ -47,13 +47,17 @@ typedef std::function Cob; template class NotificationQueue; -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__APPLE__) namespace detail { class EventBaseLocalBase; + +class EventBaseLocalBaseBase { + public: + virtual void onEventBaseDestruction(EventBase& evb) = 0; + virtual ~EventBaseLocalBaseBase() = default; +}; } template class EventBaseLocal; -#endif class EventBaseObserver { public: @@ -740,14 +744,12 @@ class EventBase : private boost::noncopyable, // allow runOnDestruction() to be called from any threads std::mutex onDestructionCallbacksMutex_; -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__APPLE__) // see EventBaseLocal friend class detail::EventBaseLocalBase; template friend class EventBaseLocal; std::mutex localStorageMutex_; std::unordered_map> localStorage_; - std::unordered_set localStorageToDtor_; -#endif + std::unordered_set localStorageToDtor_; }; } // folly diff --git a/folly/io/async/EventBaseLocal.cpp b/folly/io/async/EventBaseLocal.cpp index c8533e6d..0f08b639 100644 --- a/folly/io/async/EventBaseLocal.cpp +++ b/folly/io/async/EventBaseLocal.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__APPLE__) - #include #include #include @@ -98,5 +96,3 @@ void EventBaseLocalBase::setVoidUnlocked( std::atomic EventBaseLocalBase::keyCounter_{0}; }} - -#endif // !__ANDROID__ && !ANDROID && !__APPLE__ diff --git a/folly/io/async/EventBaseLocal.h b/folly/io/async/EventBaseLocal.h index 5681fac6..334cb601 100644 --- a/folly/io/async/EventBaseLocal.h +++ b/folly/io/async/EventBaseLocal.h @@ -16,8 +16,6 @@ #pragma once -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__APPLE__) - #include #include #include @@ -30,12 +28,12 @@ namespace folly { namespace detail { -class EventBaseLocalBase : boost::noncopyable { +class EventBaseLocalBase : public EventBaseLocalBaseBase, boost::noncopyable { public: EventBaseLocalBase() {} virtual ~EventBaseLocalBase(); void erase(EventBase& evb); - void onEventBaseDestruction(EventBase& evb); + void onEventBaseDestruction(EventBase& evb) override; protected: void setVoid(EventBase& evb, std::shared_ptr&& ptr); @@ -128,5 +126,3 @@ class EventBaseLocal : public detail::EventBaseLocalBase { } - -#endif // !__ANDROID__ && !ANDROID && !__APPLE__ -- 2.34.1