更新时间:2023-01-23 15:27:00
的线程
构造函数会将它的参数,而的消息
类型是不可拷贝。传递给需要使用的目标函数的引用的boost :: REF(MSG)
The thread
constructor copies its arguments, and the message
type is not copyable. To pass a reference to the target function you need to use boost::ref(msg)
另外请注意,使用绑定
与线程
是多余的:
Also note that using bind
with thread
is unnecessary:
boost::thread thrd(&handover_request_handler, boost::ref(msg), boost::ref(ec));
的线程
构造实现了相同的语义绑定
,因此,使用绑定
只是增加了不必要的额外拷贝。
The thread
constructor implements the same semantics as bind
, so using bind
just adds unnecessary additional copying.