summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/net/ssl_manager.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index 72a1bef041f..b2f1df6aa1f 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -106,18 +106,17 @@ namespace mongo {
void lock_callback( int mode, int type, const char *file, int line ) {
if ( mode & CRYPTO_LOCK ) {
- _mutex[type].lock();
+ _mutex[type]->lock();
}
else {
- _mutex[type].unlock();
+ _mutex[type]->unlock();
}
}
static void init() {
- // Default insert all the mutexes OpenSSL needs inside of this vector, which will
- // own them. On process termination, the vector will be responsible for their
- // deconstruction.
- _mutex = std::vector<stdx::recursive_mutex>( CRYPTO_num_locks() );
+ while ( (int)_mutex.size() < CRYPTO_num_locks() ) {
+ _mutex.emplace_back( stdx::make_unique<stdx::recursive_mutex>() );
+ }
}
static SSLThreadInfo* get() {
@@ -136,7 +135,7 @@ namespace mongo {
// Note: see SERVER-8734 for why we are using a recursive mutex here.
// Once the deadlock fix in OpenSSL is incorporated into most distros of
// Linux, this can be changed back to a nonrecursive mutex.
- static std::vector<stdx::recursive_mutex> _mutex;
+ static std::vector<std::unique_ptr<stdx::recursive_mutex>> _mutex;
static boost::thread_specific_ptr<SSLThreadInfo> _thread;
};
@@ -149,7 +148,7 @@ namespace mongo {
}
AtomicUInt32 SSLThreadInfo::_next;
- std::vector<stdx::recursive_mutex> SSLThreadInfo::_mutex;
+ std::vector<std::unique_ptr<stdx::recursive_mutex>> SSLThreadInfo::_mutex;
boost::thread_specific_ptr<SSLThreadInfo> SSLThreadInfo::_thread;
////////////////////////////////////////////////////////////////