void f(); // function
struct F {
void operator()();
}; // function object
// F’s call operator (§3.4.3)
void user()
{
thread t1 {f};
thread t2 {F()};//construct an F object. The thread task would be F()();
t1.join();
t2.join();
// f() executes in separate thread
// F()() executes in separate thread
// wait for t1
// wait for t2
}
thread using
最新推荐文章于 2022-08-28 23:05:29 发布