Threading

How do you multi thread?
Is it a poll?
I multithread with C++ threads, boost threads, or proprietary threading library.
No, what I meant is how do you do it? Like, what is the easiest way to do it, how to do it effectively, and just plain facts about it.
You might want to start with posix multithreading. This is what I started with when I first tried it. http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

If you are on windows, use Win32 API is what you are looking at. Personally I enjoy pthreads because of less typing. I have never tried win32, but from what I see from sample codes it looks a bit messy to work with.
http://www.codeproject.com/Articles/14746/Multithreading-Tutorial
http://www.codeproject.com/Articles/438/Introduction-to-Multi-threaded-Code
Last edited on
I tend to favor C++11 threads (when supported)... ie the <thread> header.

When not supported, I typically fall back to boost threads, since the API is practically identical to C++11 threads.

Like, what is the easiest way to do it


Multithreading in C++ is filled with subtleties and nuances and is very very tricky. There isn't really any "easy" way to do it. Or rather... it's really easy to do it wrong.

Best practice is to minimize the data shared by multiple threads.
Last edited on
Topic archived. No new replies allowed.