.. include:: .. ot-topic:: cxx11.multithreading.introduction :dependencies: cxx11.functions_functions.function Threads Introduction ==================== Operating System Primitives --------------------------- * C++ does not *implement* threads * They only wrap OS primitives * POSIX Threads |longrightarrow| `man pthreads `__ * Windows |longrightarrow| MSDN * Embedded OSen? There Be Dragons ---------------- **Threads are the work of the devil!** * Everything that used to be correct in a singlethreaded world is questionable in the face of threads * *Race conditions*, even in the most innocent looking places **Corollary:** * A project that was designed without threads in mind is useless with threads * Multithreading has to be planned *from the beginning* * Creation of a new thread must be justified before God *That being said ...*