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

@@ -77,7 +77,7 @@ ThreadPool::ThreadPool(int nThreads)
: _tasksRemaining(0)
, _nThreads(nThreads)
{
boostlock lock(_mutex);
scoped_lock lock(_mutex);
while (nThreads-- > 0){
Worker* worker = new Worker(*this);
_freeWorkers.push_front(worker);
@@ -99,14 +99,14 @@ ThreadPool::~ThreadPool(){
}
void ThreadPool::join(){
boostlock lock(_mutex);
scoped_lock lock(_mutex);
while(_tasksRemaining){
_condition.wait(lock);
}
}
void ThreadPool::schedule(Task task){
boostlock lock(_mutex);
scoped_lock lock(_mutex);
_tasksRemaining++;
@@ -120,7 +120,7 @@ void ThreadPool::schedule(Task task){
// should only be called by a worker from the worker thread
void ThreadPool::task_done(Worker* worker){
boostlock lock(_mutex);
scoped_lock lock(_mutex);
if (!_tasks.empty()){
worker->set_task(_tasks.front());