About 11,900 results
Open links in new tab
  1. c++ - How to use std::thread? - Stack Overflow

    Apr 23, 2015 · 8 How to use std::thread? It depends on what you're doing in the thread, but most likely you'll want to use join. It is also possible to use detach but care must be taken to make …

  2. Simple example of threading in C++ - Stack Overflow

    May 12, 2022 · Can someone post a simple example of starting two (Object Oriented) threads in C++. I'm looking for actual C++ thread objects that I can extend run methods on (or something …

  3. c++ - Start thread with member function - Stack Overflow

    May 20, 2012 · 409 I am trying to construct a std::thread with a member function that takes no arguments and returns void. I can't figure out any syntax that works - the compiler complains …

  4. c++ - What exactly is an std::thread? - Stack Overflow

    May 2, 2021 · 4 std::thread is not a "hardware thread". std::thread is a class in the C++ standard library. Instance of the std::thread class is an object that acts as a RAII container for a "native …

  5. What is std::jthread in c++20? - Stack Overflow

    Jun 11, 2020 · For std::thread, if the thread is still joinable upon destruction, it leads to a call to std::terminate, potentially causing errors in applications (not terminating all threads). Using …

  6. c++ - Consequences, pros, cons using std::thread vs windows ...

    Aug 28, 2014 · What are the pros, cons and consequences of using C++11 std::thread vs WinAPI functions (such as CreateThread, _beginthreadex, etc.) ?

  7. std::thread management: usage and best practice - Stack Overflow

    Oct 17, 2013 · This makes direct use of std::thread very, very low-level behavior. Ok for Hello World, but in a real application, best encapsulated away in a mid-level handler, either via …

  8. C++11 std::thread vs Posix threads - Stack Overflow

    Oct 30, 2012 · The std::thread library is implemented on top of pthreads in an environment supporting pthreads (for example: libstdc++). I think the big difference between the two is …

  9. Start thread within member function using std::thread & std::bind

    Oct 7, 2019 · When you called std::thread(&Task::executeThread, this); you were actually invoking the thread constructor. This is the start of the thread life and the object lifetime.

  10. c++ - std::thread : how to declare a thread in class body as a …

    Feb 14, 2012 · Also, you should not expose the std::thread member of the class. Data members should, as a general rule, be private to increase encapsulation, make it easier to modify the …