C++ 2011 : std::thread : simple example to parallelize a loop?

前端 未结 6 1268
感动是毒
感动是毒 2020-12-13 07:14

C++ 2011 includes very cool new features, but I can\'t find a lot of example to parallelize a for-loop. So my very naive question is : how do you parallelize a simple for lo

6条回答
  •  别那么骄傲
    2020-12-13 07:47

    Well obviously it depends on what your loop does, how you choose to parallellize, and how you manage the threads lifetime.

    I'm reading the book from the std C++11 threading library (that is also one of the boost.thread maintainer and wrote Just Thread ) and I can see that "it depends".

    Now to give you an idea of basics using the new standard threading, I would recommend to read the book as it gives plenty of examples. Also, take a look at http://www.justsoftwaresolutions.co.uk/threading/ and https://stackoverflow.com/questions/415994/boost-thread-tutorials

提交回复
热议问题