diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2015-02-27 18:33:28 -0500 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2015-03-12 17:11:20 -0400 |
commit | 7cd9cf303c824478f0f6d60cadfcc1a25bdb21f2 (patch) | |
tree | ebeec8c3c2dc21359b941d95e2109e355542e65f /src/mongo/util/concurrency/ticketholder.cpp | |
parent | 7ee3d124070db157181bc1b24f2b84913957c388 (diff) | |
download | mongo-7cd9cf303c824478f0f6d60cadfcc1a25bdb21f2.tar.gz |
SERVER-17310 Make mongo::mutex a typedef of boost::mutex and remove mongo::scoped_lock.
Diffstat (limited to 'src/mongo/util/concurrency/ticketholder.cpp')
-rw-r--r-- | src/mongo/util/concurrency/ticketholder.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/mongo/util/concurrency/ticketholder.cpp b/src/mongo/util/concurrency/ticketholder.cpp index efec9b50ee2..2bda04c5c10 100644 --- a/src/mongo/util/concurrency/ticketholder.cpp +++ b/src/mongo/util/concurrency/ticketholder.cpp @@ -122,38 +122,33 @@ namespace mongo { #else - TicketHolder::TicketHolder( int num ) - : _outof(num), - _num(num), - _mutex("TicketHolder") { - } + TicketHolder::TicketHolder( int num ) : _outof(num), _num(num) {} - TicketHolder::~TicketHolder(){ - } + TicketHolder::~TicketHolder() = default; bool TicketHolder::tryAcquire() { - scoped_lock lk( _mutex ); + boost::lock_guard<boost::mutex> lk( _mutex ); return _tryAcquire(); } void TicketHolder::waitForTicket() { - scoped_lock lk( _mutex ); + boost::unique_lock<boost::mutex> lk( _mutex ); while( ! _tryAcquire() ) { - _newTicket.wait( lk.boost() ); + _newTicket.wait( lk ); } } void TicketHolder::release() { { - scoped_lock lk( _mutex ); + boost::lock_guard<boost::mutex> lk( _mutex ); _num++; } _newTicket.notify_one(); } Status TicketHolder::resize( int newSize ) { - scoped_lock lk( _mutex ); + boost::lock_guard<boost::mutex> lk( _mutex ); int used = _outof.load() - _num; if ( used > newSize ) { |