C++ std::async run on main thread

后端 未结 2 1810
囚心锁ツ
囚心锁ツ 2021-02-01 23:05

IS there a way of running a function back on the main thread ?

So if I called a function via Async that downloaded a file and then parsed the data. It would then call a

2条回答
  •  时光说笑
    2021-02-01 23:48

    Are you looking for std::launch::deferred ? Passing this parameter to std::async makes the task executed on the calling thread when the get() function is called for the first time.

提交回复
热议问题