I just stuck at a very simple problem in concurrent application in cpp.
so the problem is, in a parallel application, I want to delete an object at a time, but I don't know when should I delete it, because this is possible just after deleting the object the blocked thread wants to use it. i other word I want to know how many threads are holding the reference at a same time, and the hard thing is deleting the object is done by a thread-safe function.
A friend told me to use std::shared_ptr, but if I be honest, I really cannot figure out how would I use it in this situation.
thanks in advanced.