diff options
author | Aaron Bannert <aaron@apache.org> | 2001-10-19 23:25:28 +0000 |
---|---|---|
committer | Aaron Bannert <aaron@apache.org> | 2001-10-19 23:25:28 +0000 |
commit | 7b90fcff548ba13cc6706537d91fe9d5ab86ac37 (patch) | |
tree | 0b1764fea1dd51a94805db1951951b5659126fd5 /locks/beos | |
parent | 3514f5c6697082e5b9e38cbdb18c7f1732a5f677 (diff) | |
download | apr-7b90fcff548ba13cc6706537d91fe9d5ab86ac37.tar.gz |
Implement portable accessors for proc mutex. These are equivalent to
apr_os_lock_get/set, but they work for apr_proc_mutex_t types instead.
I did my best to implement these on non-Unix platforms from how I saw
them implemented for apr_os_lock_get/set, but on those platforms they
are untested.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62447 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/beos')
-rw-r--r-- | locks/beos/proc_mutex.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/locks/beos/proc_mutex.c b/locks/beos/proc_mutex.c index 32ac2ee7f..c5209831f 100644 --- a/locks/beos/proc_mutex.c +++ b/locks/beos/proc_mutex.c @@ -104,3 +104,30 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) +/* Implement OS-specific accessors defined in apr_portable.h */ + +APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, + apr_proc_mutex_t *pmutex) +{ + ospmutex->sem = pmutex->Lock; + ospmutex->ben = pmutex->LockCount; + return APR_SUCCESS; +} + +APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, + apr_os_proc_mutex_t *ospmutex, + apr_pool_t *pool) +{ + if (pool == NULL) { + return APR_ENOPOOL; + } + if ((*pmutex) == NULL) { + (*pmutex) = (apr_proc_mutex_t *)apr_pcalloc(pool, + sizeof(apr_proc_mutex_t)); + (*pmutex)->pool = pool; + } + (*pmutex)->Lock = ospmutex->sem; + (*pmutex)->LockCount = ospmutex->ben; + return APR_SUCCESS; +} + |