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 @@
#pragma once
#include <boost/noncopyable.hpp>
#include <functional>
namespace folly { namespace wangle {
typedef std::function<void()> Func;
/// An Executor accepts units of work with add(), which should be
/// threadsafe.
class Executor {
public:
virtual ~Executor() = default;
/// Enqueue a function to executed by this executor. This and all
/// variants must be threadsafe.
virtual void add(Func) = 0;
/// 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,
/// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this.
template <class P>
void addPtr(P fn) {
this->add([fn]() mutable { (*fn)(); });
}
};
}}
typedef std::function<void()> Func;
/// An Executor accepts units of work with add(), which should be
/// threadsafe.
class Executor {
public:
virtual ~Executor() = default;
/// Enqueue a function to executed by this executor. This and all
/// variants must be threadsafe.
virtual void add(Func) = 0;
/// 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,
/// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this.
template <class P>
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