From 6ecb0cd2bc83a4d049362f53df9d08f69a90abee Mon Sep 17 00:00:00 2001 From: James Sedgwick Date: Thu, 11 Dec 2014 07:41:44 -0800 Subject: [PATCH] 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 --- folly/wangle/Executor.h | 49 +++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/folly/wangle/Executor.h b/folly/wangle/Executor.h index b7c31fb7..bd720f60 100644 --- a/folly/wangle/Executor.h +++ b/folly/wangle/Executor.h @@ -16,30 +16,31 @@ #pragma once -#include #include namespace folly { namespace wangle { - typedef std::function 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 - void addPtr(P fn) { - this->add([fn]() mutable { (*fn)(); }); - } - }; -}} + +typedef std::function 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 + void addPtr(P fn) { + this->add([fn]() mutable { (*fn)(); }); + } +}; + +}} // folly::wangle -- 2.34.1