Stopping C++ 11 std::threads waiting on a std::condition_variable

前端 未结 2 491
孤城傲影
孤城傲影 2021-02-02 07:21

I am trying to understand the basic multithreading mechanisms in the new C++ 11 standard. The most basic example I can think of is the following:

  • A producer and a
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-02 08:20

    wait can be called with a timeout. Control is returned to the thread and stop could be checked. Depending on that value it can wait on more items to be consumed or finish execution. A good introduction to multithreading with c++ is C++11 Concurrency .

提交回复
热议问题