diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-09-08 12:59:57 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-09-08 12:59:57 +0200 |
commit | 4d4ce59d2be82a1a0aebe8d527da1e660395c063 (patch) | |
tree | e7c745ca4a7385a3b1a8006078b5b6428dd4fcf8 /include/atomic | |
parent | efc93eb3d1ec33d9f9357872c70b4044f26e7785 (diff) | |
download | mariadb-git-4d4ce59d2be82a1a0aebe8d527da1e660395c063.tar.gz |
compilation fixes for WITH_ATOMIC_OPS=rwlocks
Diffstat (limited to 'include/atomic')
-rw-r--r-- | include/atomic/rwlock.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/include/atomic/rwlock.h b/include/atomic/rwlock.h index f6bf7d0b76f..2ffdd384cc5 100644 --- a/include/atomic/rwlock.h +++ b/include/atomic/rwlock.h @@ -41,13 +41,6 @@ typedef char my_atomic_rwlock_t; typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t; -#ifndef SAFE_MUTEX - -/* - we're using read-write lock macros but map them to mutex locks, and they're - faster. Still, having semantically rich API we can change the - underlying implementation, if necessary. -*/ #define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw) #define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0) #define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw) @@ -55,37 +48,6 @@ typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t; #define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw) #define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw) -#else /* SAFE_MUTEX */ - -/* - SAFE_MUTEX pollutes the compiling name space with macros - that alter pthread_mutex_t, pthread_mutex_init, etc. - Atomic operations should never use the safe mutex wrappers. - Unfortunately, there is no way to have both: - - safe mutex macros expanding pthread_mutex_lock to safe_mutex_lock - - my_atomic macros expanding to unmodified pthread_mutex_lock - inlined in the same compilation unit. - So, in case of SAFE_MUTEX, a function call is required. - Given that SAFE_MUTEX is a debugging facility, - this extra function call is not a performance concern for - production builds. -*/ -C_MODE_START -extern void plain_pthread_mutex_init(safe_mutex_t *); -extern void plain_pthread_mutex_destroy(safe_mutex_t *); -extern void plain_pthread_mutex_lock(safe_mutex_t *); -extern void plain_pthread_mutex_unlock(safe_mutex_t *); -C_MODE_END - -#define my_atomic_rwlock_destroy(name) plain_pthread_mutex_destroy(&(name)->rw) -#define my_atomic_rwlock_init(name) plain_pthread_mutex_init(&(name)->rw) -#define my_atomic_rwlock_rdlock(name) plain_pthread_mutex_lock(&(name)->rw) -#define my_atomic_rwlock_wrlock(name) plain_pthread_mutex_lock(&(name)->rw) -#define my_atomic_rwlock_rdunlock(name) plain_pthread_mutex_unlock(&(name)->rw) -#define my_atomic_rwlock_wrunlock(name) plain_pthread_mutex_unlock(&(name)->rw) - -#endif /* SAFE_MUTEX */ - #define MY_ATOMIC_MODE "mutex" #ifndef MY_ATOMIC_MODE_RWLOCKS #define MY_ATOMIC_MODE_RWLOCKS 1 |