if you try to avoid deadlock, you can use boost::recursive_mutex