Commit 6ecb0cd2 authored by James Sedgwick's avatar James Sedgwick Committed by Dave Watson

formatting nits in Executor.h

Summary:
sorry this was bothering me
also remove extra include

Test Plan: OK

Reviewed By: davejwatson@fb.com

Subscribers: fugalh, folly-diffs@

FB internal diff: D1733723

Signature: t1:1733723:1418312030:088eb084f69e2bd7703724464b2f3e71abc2607a
parent c2132bba
...@@ -16,30 +16,31 @@ ...@@ -16,30 +16,31 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <functional> #include <functional>
namespace folly { namespace wangle { namespace folly { namespace wangle {
typedef std::function<void()> Func;
typedef std::function<void()> Func;
/// An Executor accepts units of work with add(), which should be
/// threadsafe. /// An Executor accepts units of work with add(), which should be
class Executor { /// threadsafe.
public: class Executor {
virtual ~Executor() = default; public:
virtual ~Executor() = default;
/// Enqueue a function to executed by this executor. This and all
/// variants must be threadsafe. /// Enqueue a function to executed by this executor. This and all
virtual void add(Func) = 0; /// variants must be threadsafe.
virtual void add(Func) = 0;
/// A convenience function for shared_ptr to legacy functors.
/// /// A convenience function for shared_ptr to legacy functors.
/// Sometimes you have a functor that is move-only, and therefore can't be ///
/// converted to a std::function (e.g. std::packaged_task). In that case, /// Sometimes you have a functor that is move-only, and therefore can't be
/// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this. /// converted to a std::function (e.g. std::packaged_task). In that case,
template <class P> /// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this.
void addPtr(P fn) { template <class P>
this->add([fn]() mutable { (*fn)(); }); void addPtr(P fn) {
} this->add([fn]() mutable { (*fn)(); });
}; }
}} };
}} // folly::wangle
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