From 95319cc5974de138f60353719778cde7fe302a12 Mon Sep 17 00:00:00 2001 From: Aaron Bannert Date: Tue, 9 Apr 2002 15:53:09 +0000 Subject: [PATCH] Convert mod_ssl to the new apr_global_mutex.h API and remove all uses of apr_lock.h [deprecated]. Tested that I could serve simple SSL (v3) pages. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94583 13f79535-47bb-0310-9956-ffa450edef68 --- modules/ssl/mod_ssl.h | 3 ++- modules/ssl/ssl_engine_mutex.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/ssl/mod_ssl.h b/modules/ssl/mod_ssl.h index f27cffb83e..9420244eed 100644 --- a/modules/ssl/mod_ssl.h +++ b/modules/ssl/mod_ssl.h @@ -102,6 +102,7 @@ #include "apr_dbm.h" #include "apr_rmm.h" #include "apr_shm.h" +#include "apr_global_mutex.h" #include "apr_optional.h" #define MOD_SSL_VERSION AP_SERVER_BASEREVISION @@ -449,7 +450,7 @@ typedef struct { apr_table_t *tSessionCacheDataTable; ssl_mutexmode_t nMutexMode; const char *szMutexFile; - apr_lock_t *pMutex; + apr_global_mutex_t *pMutex; apr_array_header_t *aRandSeed; apr_hash_t *tVHostKeys; void *pTmpKeys[SSL_TMP_KEY_MAX]; diff --git a/modules/ssl/ssl_engine_mutex.c b/modules/ssl/ssl_engine_mutex.c index 2696969eeb..f5ee1df13e 100644 --- a/modules/ssl/ssl_engine_mutex.c +++ b/modules/ssl/ssl_engine_mutex.c @@ -69,8 +69,8 @@ int ssl_mutex_init(server_rec *s, apr_pool_t *p) if (mc->nMutexMode == SSL_MUTEXMODE_NONE) return TRUE; - if (apr_lock_create(&mc->pMutex, APR_MUTEX, APR_LOCKALL, APR_LOCK_DEFAULT, - mc->szMutexFile, p) != APR_SUCCESS) { + if (apr_global_mutex_create(&mc->pMutex, mc->szMutexFile, + APR_LOCK_DEFAULT, p) != APR_SUCCESS) { ssl_log(s, SSL_LOG_ERROR, "Cannot create SSLMutex file `%s'", mc->szMutexFile); @@ -86,7 +86,8 @@ int ssl_mutex_reinit(server_rec *s, apr_pool_t *p) if (mc->nMutexMode == SSL_MUTEXMODE_NONE) return TRUE; - if (apr_lock_child_init(&mc->pMutex, mc->szMutexFile, p) != APR_SUCCESS) + if (apr_global_mutex_child_init(&mc->pMutex, + mc->szMutexFile, p) != APR_SUCCESS) return FALSE; return TRUE; } @@ -97,7 +98,7 @@ int ssl_mutex_on(server_rec *s) if (mc->nMutexMode == SSL_MUTEXMODE_NONE) return TRUE; - if (apr_lock_acquire(mc->pMutex) != APR_SUCCESS) { + if (apr_global_mutex_lock(mc->pMutex) != APR_SUCCESS) { ssl_log(s, SSL_LOG_WARN, "Failed to acquire global mutex lock"); return FALSE; } @@ -110,7 +111,7 @@ int ssl_mutex_off(server_rec *s) if (mc->nMutexMode == SSL_MUTEXMODE_NONE) return TRUE; - if (apr_lock_release(mc->pMutex) != APR_SUCCESS) { + if (apr_global_mutex_unlock(mc->pMutex) != APR_SUCCESS) { ssl_log(s, SSL_LOG_WARN, "Failed to release global mutex lock"); return FALSE; } -- 2.40.0