From b67c93f4794b06b57b9601b96421289acadadc6b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Jun 2017 10:12:41 +0200 Subject: Reimplement thread thunking with lambda; this helps Clang 5.0/trunk --- build2/test/script/builtin.cxx | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'build2') diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx index d45b200..62f011b 100644 --- a/build2/test/script/builtin.cxx +++ b/build2/test/script/builtin.cxx @@ -1348,32 +1348,24 @@ namespace build2 return 1; } - static void - thread_thunk (builtin_impl* fn, - scope& sp, - const strings& args, - auto_fd in, auto_fd out, auto_fd err, - uint8_t& r) noexcept - { - r = fn (sp, args, move (in), move (out), move (err)); - } - // Run builtin implementation asynchronously. // static builtin - async_impl (builtin_impl fn, + async_impl (builtin_impl* fn, scope& sp, uint8_t& r, const strings& args, auto_fd in, auto_fd out, auto_fd err) { - return builtin (r, - thread (thread_thunk, - fn, - ref (sp), - cref (args), - move (in), move (out), move (err), - ref (r))); + return builtin ( + r, + thread ([&fn, &sp, &r, &args, + in = move (in), + out = move (out), + err = move (err)] () mutable noexcept + { + r = fn (sp, args, move (in), move (out), move (err)); + })); } template -- cgit v1.1