diff options
author | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2002-06-11 15:35:25 +0000 |
---|---|---|
committer | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2002-06-11 15:35:25 +0000 |
commit | 3785d79b44250223e7e2d6e6b51e88ebfc277d66 (patch) | |
tree | 70e9fdb02884928d13714022be120814e435f8d1 /atomic | |
parent | 6517b2b03ce5a06570848a44648ec7fee000960f (diff) | |
download | libapr-3785d79b44250223e7e2d6e6b51e88ebfc277d66.tar.gz |
Use the native cmpxchg() function for NetWare
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r-- | atomic/netware/apr_atomic.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/atomic/netware/apr_atomic.c b/atomic/netware/apr_atomic.c index 7687a126d..ff21945eb 100644 --- a/atomic/netware/apr_atomic.c +++ b/atomic/netware/apr_atomic.c @@ -54,56 +54,11 @@ #include "apr.h" -#include "apr_thread_mutex.h" #include "apr_atomic.h" -#if APR_HAS_THREADS - -#if defined(APR_ATOMIC_NEED_DEFAULT) || defined(APR_ATOMIC_NEED_CAS_DEFAULT) - -#define NUM_ATOMIC_HASH 7 -/* shift by 2 to get rid of alignment issues */ -#define ATOMIC_HASH(x) (int)(((long)x>>2)%NUM_ATOMIC_HASH) -static apr_thread_mutex_t **hash_mutex; - -apr_status_t apr_atomic_init(apr_pool_t *p ) -{ - int i; - apr_status_t rv; - hash_mutex =apr_palloc(p,sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH); - for (i=0;i<NUM_ATOMIC_HASH;i++) { - rv = apr_thread_mutex_create(&(hash_mutex[i]), APR_THREAD_MUTEX_DEFAULT, p); - if (rv != APR_SUCCESS) - return rv; - } - return APR_SUCCESS; -} -#endif /* APR_ATOMIC_NEED_DEFAULT || APR_ATOMIC_NEED_CAS_DEFAULT */ - int apr_atomic_dec(apr_atomic_t *mem) { atomic_dec(mem); return *mem; } -#if defined(APR_ATOMIC_NEED_CAS_DEFAULT) - -apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem,long with, long cmp) -{ - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - long prev; - - if (apr_thread_mutex_lock(lock) == APR_SUCCESS) { - prev = *(long*)mem; - if ( prev == cmp) { - *(long*)mem = with; - } - apr_thread_mutex_unlock(lock); - return prev; - } - return *(long*)mem; -} -#endif /* APR_ATOMIC_NEED_CAS_DEFAULT */ - - -#endif /* APR_HAS_THREADS */ |