【发布时间】:2012-09-07 15:00:42
【问题描述】:
如果这是一个错误,我只是不这样做没有问题,但如果这是预期的行为,我想知道为什么。
我会这样做:
{
boost::lock_guard<boost::mutex> lg(tagsToSocketsMtx);
// mutex protected work
lg.~lock_guard(); // this causes deadlocks later(combined with ...
//...other uses of the same mtx, ofc I use different lock guard in other functions)
// rest of the function
}
【问题讨论】: