SERVER-695 don't destroy static global mutexes

This commit is contained in:
Aaron
2010-03-09 23:59:10 -08:00
parent c4b55b2957
commit 714ec2fdc8
50 changed files with 204 additions and 153 deletions

View File

@@ -68,7 +68,7 @@ namespace mongo {
};
vector<boost::shared_ptr<StickyThread> > thread_pool;
boost::mutex tp_mutex; // this is only needed if io_service::run() is called from multiple threads
mongo::mutex tp_mutex; // this is only needed if io_service::run() is called from multiple threads
}
class MessageServerSession : public boost::enable_shared_from_this<MessageServerSession> , public AbstractMessagingPort {
@@ -117,7 +117,7 @@ namespace mongo {
void handleReadBody( const boost::system::error_code& error ){
if (!_myThread){
boost::mutex::scoped_lock(tp_mutex);
mongo::mutex::scoped_lock(tp_mutex);
if (!thread_pool.empty()){
_myThread = thread_pool.back();
thread_pool.pop_back();
@@ -148,7 +148,7 @@ namespace mongo {
void handleWriteDone( const boost::system::error_code& error ){
{
// return thread to pool after we have sent data to the client
boost::mutex::scoped_lock(tp_mutex);
mongo::mutex::scoped_lock(tp_mutex);
assert(_myThread);
thread_pool.push_back(_myThread);
_myThread.reset();