-void ssl_lock(int mode, int n, const char *file, int line);
-
-
-// OpenSSL wants a callback function to identify the currently running thread.
-// Since we are a pthreads program, we convert the output of pthread_self() to a long.
-static unsigned long id_callback(void) {
- return (unsigned long) pthread_self();
-}
-
-
-// OpenSSL wants a callback function to set and clear various types of locks.
-// Since we are a pthreads program, we use mutexes.
-void ssl_lock(int mode, int n, const char *file, int line) {
- if (mode & CRYPTO_LOCK) {
- pthread_mutex_lock(SSLCritters[n]);
- }
- else {
- pthread_mutex_unlock(SSLCritters[n]);
- }
-}