C++ 是并发::任务<_ty>;赋值运算符线程安全? task t=[] { //做点什么 }; void post(标准::函数tExecute) { t=t.then(tExecute); }

C++ 是并发::任务<_ty>;赋值运算符线程安全? task t=[] { //做点什么 }; void post(标准::函数tExecute) { t=t.then(tExecute); },c++,visual-c++,concurrency-runtime,C++,Visual C++,Concurrency Runtime,我试图使用上面的代码创建一个串,其中多个线程可以调用post以确保某些任务(函数/lambda)的顺序处理。 post()中的赋值是线程安全的吗 task<void> t = [] { //do something }; void post(std::function<void()> tExecute) { t = t.then(tExecute); }

我试图使用上面的代码创建一个串,其中多个线程可以调用post以确保某些任务(函数/lambda)的顺序处理。 post()中的赋值是线程安全的吗

task<void> t = []
{
     //do something
};

void post(std::function<void()> tExecute)
{
     t = t.then(tExecute);
}