TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OpenSSLCrypto Namespace Reference

Functions

TC_COMMON_API void threadsSetup ()
 Needs to be called before threads using openssl are spawned. More...
 
TC_COMMON_API void threadsCleanup ()
 Needs to be called after threads using openssl are despawned. More...
 

Detailed Description

A group of functions which setup openssl crypto module to work properly in multithreaded enviroment If not setup properly - it will crash

Function Documentation

void OpenSSLCrypto::threadsCleanup ( )

Needs to be called after threads using openssl are despawned.

51 {
52  CRYPTO_set_locking_callback(NULL);
53  CRYPTO_THREADID_set_callback(NULL);
54  for(int i = 0 ; i < CRYPTO_num_locks(); ++i)
55  {
56  delete cryptoLocks[i];
57  }
58  cryptoLocks.resize(0);
59 }
arena_t NULL
Definition: jemalloc_internal.h:624
std::vector< std::mutex * > cryptoLocks
Definition: OpenSSLCrypto.cpp:24

+ Here is the caller graph for this function:

void OpenSSLCrypto::threadsSetup ( )

Needs to be called before threads using openssl are spawned.

40 {
41  cryptoLocks.resize(CRYPTO_num_locks());
42  for(int i = 0 ; i < CRYPTO_num_locks(); ++i)
43  {
44  cryptoLocks[i] = new std::mutex;
45  }
46  CRYPTO_THREADID_set_callback(threadIdCallback);
47  CRYPTO_set_locking_callback(lockingCallback);
48 }
static void threadIdCallback(CRYPTO_THREADID *id)
Definition: OpenSSLCrypto.cpp:34
static void lockingCallback(int mode, int type, const char *, int)
Definition: OpenSSLCrypto.cpp:26
std::vector< std::mutex * > cryptoLocks
Definition: OpenSSLCrypto.cpp:24

+ Here is the call graph for this function:

+ Here is the caller graph for this function: