首先调用thread的构造函数
thread();
-
Effects:
-
Constructs a
boost::thread
instance that refers to Not-a-Thread.
Throws:
-
Nothing
解释:这个构造函数并不附加线程,自然无法启动
template<typename Callable> thread(Callable func);
-
Preconditions:
-
Callable
must by copyable.
Effects:
-
func
is copied into storage managed internally by the thread library, and that copy is invoked on a newly-created thread of execution. If this invocation results in an exception being propagated into the internals of the thread library that is not of typeboost::thread_interrupted
, thenstd