Category : multithreading

I’ve created a new thread using the std::thread and then called detach method on the thread object to let the thread to run independently from the calling program. My question is what will happen with a such detached thread when the calling process terminates while the tread is still running (doing some long time, background ..

Read more

I try to understand how atomic reference counting works but fail to grasp how reference counts propagate to all copies of an instance. Based on this question and on the boost reference I constructed the following code: #include <atomic> #include <iostream> struct X { X() : ref_cout_(1){}; mutable std::atomic<int> ref_cout_; X(const X* other) { other->ref_cout_.fetch_add(1, ..

Read more

I am currently comparing speculative and non-speculative locking with Intel TSX and OpenMP in C++. The code is compiled with the Intel icpc compiler to the C++17-standard and run on linux. I am comparing the execution times I measured with chrono::duration between different configurations. However my data has been very inconsistent between runs which lead ..

Read more