diff options
Diffstat (limited to 'src/mongo/util/net/http_client_curl.cpp')
-rw-r--r-- | src/mongo/util/net/http_client_curl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/util/net/http_client_curl.cpp b/src/mongo/util/net/http_client_curl.cpp index 20ca65442b3..bddb5fb910f 100644 --- a/src/mongo/util/net/http_client_curl.cpp +++ b/src/mongo/util/net/http_client_curl.cpp @@ -131,17 +131,21 @@ private: } static void _lockShare(CURL*, curl_lock_data, curl_lock_access, void* ctx) { - reinterpret_cast<Mutex*>(ctx)->lock(); + reinterpret_cast<stdx::recursive_mutex*>(ctx)->lock(); } static void _unlockShare(CURL*, curl_lock_data, void* ctx) { - reinterpret_cast<Mutex*>(ctx)->unlock(); + reinterpret_cast<stdx::recursive_mutex*>(ctx)->unlock(); } private: bool _initialized = false; CURLSH* _share = nullptr; - Mutex _shareMutex = MONGO_MAKE_LATCH("CurlLibraryManager::_shareMutex"); + + // A recursive mutex here is needed because CURL needs to lock this multiple times depending + // on the "internal CURL type" of the object that CURL is sending. Using a normal mutex + // causes the CURL system to deadlock. + stdx::recursive_mutex _shareMutex{}; } curlLibraryManager; /** |