From: Andrew Nelless Date: Wed, 24 Feb 2016 15:10:22 +0000 (+0000) Subject: Switch from std::function to boost::function X-Git-Tag: rec-4.0.0-alpha2~54^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3427%2Fhead;p=thirdparty%2Fpdns.git Switch from std::function to boost::function GNUs implementation of std::function can't eat 3 pointers without allocating, (24 bytes) whereas both LLVM libc++ and boost::function can. boost::function has been move enabled since 1.52 (Nov 2012). --- diff --git a/pdns/mtasker.hh b/pdns/mtasker.hh index 4fa965af2f..6261e0afaa 100644 --- a/pdns/mtasker.hh +++ b/pdns/mtasker.hh @@ -33,6 +33,7 @@ #include "misc.hh" #include "mtasker_context.hh" #include +#include using namespace ::boost::multi_index; // #define MTASKERTIMING 1 @@ -56,7 +57,7 @@ private: struct ThreadInfo { std::shared_ptr context; - std::function start; + boost::function start; char* startOfStack; char* highestStackSeen; #ifdef MTASKERTIMING diff --git a/pdns/mtasker_context.hh b/pdns/mtasker_context.hh index 82112892e9..45a73784ec 100644 --- a/pdns/mtasker_context.hh +++ b/pdns/mtasker_context.hh @@ -2,7 +2,7 @@ #define MTASKER_CONTEXT_HH #include "lazy_allocator.hh" -#include +#include #include #include @@ -24,6 +24,6 @@ pdns_swapcontext void pdns_makecontext -(pdns_ucontext_t& ctx, std::function& start); +(pdns_ucontext_t& ctx, boost::function& start); #endif // MTASKER_CONTEXT_HH diff --git a/pdns/mtasker_fcontext.cc b/pdns/mtasker_fcontext.cc index 77f473cf1d..a6a9d177c4 100644 --- a/pdns/mtasker_fcontext.cc +++ b/pdns/mtasker_fcontext.cc @@ -34,7 +34,7 @@ static_assert (std::is_pointer::value, struct args_t { fcontext_t prev_ctx = nullptr; pdns_ucontext_t* self = nullptr; - std::function* work = nullptr; + boost::function* work = nullptr; }; extern "C" { @@ -84,7 +84,7 @@ pdns_swapcontext void pdns_makecontext -(pdns_ucontext_t& ctx, std::function& start) { +(pdns_ucontext_t& ctx, boost::function& start) { assert (ctx.uc_link); assert (ctx.uc_stack.size() >= 8192); assert (!ctx.uc_mcontext); diff --git a/pdns/mtasker_ucontext.cc b/pdns/mtasker_ucontext.cc index a10dbe17e0..aba7955e80 100644 --- a/pdns/mtasker_ucontext.cc +++ b/pdns/mtasker_ucontext.cc @@ -47,7 +47,7 @@ void threadWrapper (int const ctx0, int const ctx1, int const fun0, int const fun1) { auto ctx = joinPtr(ctx0, ctx1); try { - auto start = std::move(*joinPtr>(fun0, fun1)); + auto start = std::move(*joinPtr>(fun0, fun1)); start(); } catch (...) { ctx->exception = std::current_exception(); @@ -78,7 +78,7 @@ pdns_swapcontext void pdns_makecontext -(pdns_ucontext_t& ctx, std::function& start) { +(pdns_ucontext_t& ctx, boost::function& start) { assert (ctx.uc_link); assert (ctx.uc_stack.size());