Documentation Home >> Headers >> <jss/joining_thread.hpp> Header >> jss::joining_thread >> jss::joining_thread Constructor

Construct a jss::joining_thread object associated with a new thread of execution.

template<typename Callable,typename Args...>
explicit joining_thread(Callable func,Args... args);

Preconditions:

func and each element of args must be MoveConstructible

Effects:

Constructs a jss::joining_thread instance, and associates it with a newly-created thread of execution. Copies or moves func and args into internal storage associated that persists for the lifetime of the new thread of execution. Runs the supplied function func on that new thread of execution by INVOKE(func,args).

Postconditions:

For a newly-constructed jss::joining_thread object x, x.get_id()!=id().

Throws:

An exception of type std::system_error if unable to start the new thread. Any exception thrown by copying func or args into internal storage.

Synchronization:

The invocation of the constructor happens-before the execution of the supplied function on the newly-created thread of execution.

Header

#include <jss/joining_thread.hpp>

See Also