Guard SSLContext lock checks with init mutex and add setSSLLockTypesAndInitOpenSSL
[folly.git] / folly / io / async / SSLContext.h
index 5e539e0c20f4eefa69b32f80650bafa9059e396b..a381eb37e578a3f5c5fd49f66f5409f234fcf98b 100644 (file)
@@ -449,6 +449,13 @@ class SSLContext {
    */
   static void setSSLLockTypes(std::map<int, SSLLockType> lockTypes);
 
+  /**
+   * Set the lock types and initialize OpenSSL in an atomic fashion.  This
+   * aborts if the library has already been initialized.
+   */
+  static void setSSLLockTypesAndInitOpenSSL(
+      std::map<int, SSLLockType> lockTypes);
+
   /**
    * Determine if the SSL lock with the specified id (i.e.
    * CRYPTO_LOCK_SSL_SESSION) is disabled.  This should be called after
@@ -594,6 +601,7 @@ class SSLContext {
   // Functions are called when locked by the calling function.
   static void initializeOpenSSLLocked();
   static void cleanupOpenSSLLocked();
+  static void setSSLLockTypesLocked(std::map<int, SSLLockType> inLockTypes);
 };
 
 typedef std::shared_ptr<SSLContext> SSLContextPtr;