summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Jackson <spencer.jackson@mongodb.com>2015-06-19 17:27:25 -0400
committerSpencer Jackson <spencer.jackson@mongodb.com>2015-06-19 18:22:25 -0400
commit4b5fa5fc711e4cf94291665575fd1c742ad3e7c3 (patch)
tree32de8db01d560760f8362cf77dbdc556f4076d9f /src
parent299b2c1d833c6ca537e300b5bc49384a7a81e5cd (diff)
downloadmongo-4b5fa5fc711e4cf94291665575fd1c742ad3e7c3.tar.gz
SERVER-19051 Use unique_ptr in SSLThreadInfo to fix MSVC builds
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;
////////////////////////////////////////////////////////////////