This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Replace __bind_simple with std::thread::__make_invoker


Some time ago I added __bind_simple, which is a simpler version of
std::bind that doesn't support placeholders and nested bind
expressions. It's only needed by a few concurrency components that do
INVOKE(DECAY_COPY(f), DECAY_COPY(args)...) but those conponents have
to include the whole of <functional> to get it.

Now that std::call_once() doesn't use it, it's only needed in <thread>
and <future> so I'm moving it into <thread>, renaming it to
std::thread::__make_invoker, and adding some comments about its
purpose.

std::packaged_task shouldn't be using that function anyway, because it
doesn't want the DECAY_COPY semantics and I was forced to wrap the
arguments in reference_wrappers to prevent the decaying. Like
std::call_once it can just use a lambda-expression instead.

This allows us to remove <functional> from <thread> and <future>. That
doesn't reduce the size of preprocessed source yet, because <memory>
includes the whole of <functional> anyway, but I'll reduce that soon.

	* include/std/functional (_Bind_simple, _Bind_simple_helper)
	(__bind_simple): Remove.
	* include/std/future: Include <bits/invoke.h> instead of <functional>.
	(__future_base::_Task_state::_M_run)
	(__future_base::_Task_state::_M_run_delayed): Use lambda expressions
	instead of __bind_simple.
	(__future_base::_Task_state::_S_maybe_wrap_ref): Remove.
	(async): Use thread::__make_invoker instead of __bind_simple.
	* include/std/thread: Include <tuple> and <bits/invoke.h> instead of
	<functional>.
	(thread::_Invoker, thread::__make_invoker): Define helpers to do
	INVOKE(DECAY_COPY(f), DECAY_COPY(args)...).

Tested powerpc64le-linux, committed to trunk.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]