Skip to content

Instantly share code, notes, and snippets.

View ClaymorePT's full-sized avatar

Carlos Miguel Ferreira ClaymorePT

View GitHub Profile
@ClaymorePT
ClaymorePT / problematic_miltithreading.cpp
Created October 20, 2020 14:00 — forked from facontidavide/problematic_miltithreading.cpp
This simple multithreading C++ may sometimes crash (SIGSEGV) or remain blocked forever inside waitStart. Can you figure out why?
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <atomic>
// The purpose of the this apparently fine application is to make you appreciate thread santizers
// https://clang.llvm.org/docs/ThreadSanitizer.html
class Foo{