I have to delete an object at a time that I don't know it's held by another thread(s) or not.
For example
1 2 3 4 5 6 7
staticvoid foo(CLASS* ref){
pthread_mutex_lock(&l);//[POINT-A]
//using ref
//do something thread safe
pthread_mutex_unlock(&l);
delete ref;// how can I find out there is no any thread held at [POINT-A]
}