From a08b5ac230066ab6f0041c8d4b27e1beb17d1bd3 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 10 Oct 2012 14:21:25 +0200 Subject: [PATCH] remove configure option --enable-lock-check. has done its purpose already --- arangod/VocBase/document-collection.h | 4 -- arangod/VocBase/primary-collection.h | 4 -- lib/BasicsC/local-configuration.h.in | 6 -- lib/BasicsC/locks-posix.c | 82 --------------------------- lib/BasicsC/locks.h | 10 ---- m4/configure.threads | 15 ----- 6 files changed, 121 deletions(-) diff --git a/arangod/VocBase/document-collection.h b/arangod/VocBase/document-collection.h index e602213ddf..9d9cb38bbb 100755 --- a/arangod/VocBase/document-collection.h +++ b/arangod/VocBase/document-collection.h @@ -68,7 +68,6 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// #define TRI_READ_LOCK_DATAFILES_DOC_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("read-locking datafiles %p", a); \ TRI_ReadLockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -76,7 +75,6 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// #define TRI_READ_UNLOCK_DATAFILES_DOC_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("read-unlocking datafiles %p", a); \ TRI_ReadUnlockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -84,7 +82,6 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// #define TRI_WRITE_LOCK_DATAFILES_DOC_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("write-locking datafiles %p", a); \ TRI_WriteLockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -92,7 +89,6 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// #define TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("write-unlocking datafiles %p", a); \ TRI_WriteUnlockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/VocBase/primary-collection.h b/arangod/VocBase/primary-collection.h index f4b5a3b757..9f3ffa0238 100644 --- a/arangod/VocBase/primary-collection.h +++ b/arangod/VocBase/primary-collection.h @@ -58,7 +58,6 @@ struct TRI_cap_constraint_s; //////////////////////////////////////////////////////////////////////////////// #define TRI_READ_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("read-locking collection index %p", a); \ TRI_ReadLockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -66,7 +65,6 @@ struct TRI_cap_constraint_s; //////////////////////////////////////////////////////////////////////////////// #define TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("read-unlocking collection index %p", a); \ TRI_ReadUnlockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -74,7 +72,6 @@ struct TRI_cap_constraint_s; //////////////////////////////////////////////////////////////////////////////// #define TRI_WRITE_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("write-locking collection index %p", a); \ TRI_WriteLockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// @@ -82,7 +79,6 @@ struct TRI_cap_constraint_s; //////////////////////////////////////////////////////////////////////////////// #define TRI_WRITE_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(a) \ - TRI_LOCK_CHECK_TRACE("write-unlocking collection index %p", a); \ TRI_WriteUnlockReadWriteLock(&(a)->_lock) //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/BasicsC/local-configuration.h.in b/lib/BasicsC/local-configuration.h.in index 0eb46a4393..c0714d9558 100644 --- a/lib/BasicsC/local-configuration.h.in +++ b/lib/BasicsC/local-configuration.h.in @@ -83,12 +83,6 @@ #undef TRI_ENABLE_MRUBY -//////////////////////////////////////////////////////////////////////////////// -/// @brief perform lock checking -//////////////////////////////////////////////////////////////////////////////// - -#undef TRI_ENABLE_LOCK_CHECK - //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/BasicsC/locks-posix.c b/lib/BasicsC/locks-posix.c index 4dc8355983..c483655773 100644 --- a/lib/BasicsC/locks-posix.c +++ b/lib/BasicsC/locks-posix.c @@ -76,17 +76,7 @@ //////////////////////////////////////////////////////////////////////////////// void TRI_InitMutex (TRI_mutex_t* mutex) { -#ifdef TRI_ENABLE_LOCK_CHECK - pthread_mutexattr_t attr; - - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); - - assert(mutex); - pthread_mutex_init(mutex, &attr); -#else pthread_mutex_init(mutex, 0); -#endif } //////////////////////////////////////////////////////////////////////////////// @@ -94,9 +84,6 @@ void TRI_InitMutex (TRI_mutex_t* mutex) { //////////////////////////////////////////////////////////////////////////////// void TRI_DestroyMutex (TRI_mutex_t* mutex) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(mutex); -#endif pthread_mutex_destroy(mutex); } @@ -120,9 +107,6 @@ void TRI_DestroyMutex (TRI_mutex_t* mutex) { void TRI_LockMutex (TRI_mutex_t* mutex) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(mutex); -#endif rc = pthread_mutex_lock(mutex); if (rc != 0) { @@ -142,10 +126,6 @@ void TRI_LockMutex (TRI_mutex_t* mutex) { void TRI_UnlockMutex (TRI_mutex_t* mutex) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(mutex); - // never LOG_XXX something here. this will cause infinite recursing (logging uses a mutex) -#endif rc = pthread_mutex_unlock(mutex); if (rc != 0) { @@ -179,9 +159,6 @@ void TRI_UnlockMutex (TRI_mutex_t* mutex) { //////////////////////////////////////////////////////////////////////////////// void TRI_InitSpin (TRI_spin_t* spinLock) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(spinLock); -#endif pthread_spin_init(spinLock, 0); } @@ -190,9 +167,6 @@ void TRI_InitSpin (TRI_spin_t* spinLock) { //////////////////////////////////////////////////////////////////////////////// void TRI_DestroySpin (TRI_spin_t* spinLock) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(spinLock); -#endif pthread_spin_destroy(spinLock); } @@ -216,9 +190,6 @@ void TRI_DestroySpin (TRI_spin_t* spinLock) { void TRI_LockSpin (TRI_spin_t* spinLock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(spinLock); -#endif rc = pthread_spin_lock(spinLock); if (rc != 0) { @@ -238,9 +209,6 @@ void TRI_LockSpin (TRI_spin_t* spinLock) { void TRI_UnlockSpin (TRI_spin_t* spinLock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(spinLock); -#endif rc = pthread_spin_unlock(spinLock); if (rc != 0) { @@ -274,9 +242,6 @@ void TRI_UnlockSpin (TRI_spin_t* spinLock) { //////////////////////////////////////////////////////////////////////////////// void TRI_InitReadWriteLock (TRI_read_write_lock_t* lock) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif pthread_rwlock_init(lock, 0); } @@ -285,9 +250,6 @@ void TRI_InitReadWriteLock (TRI_read_write_lock_t* lock) { //////////////////////////////////////////////////////////////////////////////// void TRI_DestroyReadWriteLock (TRI_read_write_lock_t* lock) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif pthread_rwlock_destroy(lock); } @@ -311,9 +273,6 @@ void TRI_DestroyReadWriteLock (TRI_read_write_lock_t* lock) { bool TRI_TryReadLockReadWriteLock (TRI_read_write_lock_t* lock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif rc = pthread_rwlock_tryrdlock(lock); return (rc == 0); @@ -327,10 +286,6 @@ void TRI_ReadLockReadWriteLock (TRI_read_write_lock_t* lock) { int rc; bool complained = false; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif - again: rc = pthread_rwlock_rdlock(lock); @@ -369,9 +324,6 @@ again: void TRI_ReadUnlockReadWriteLock (TRI_read_write_lock_t* lock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif rc = pthread_rwlock_unlock(lock); if (rc != 0) { @@ -388,9 +340,6 @@ void TRI_ReadUnlockReadWriteLock (TRI_read_write_lock_t* lock) { void TRI_WriteLockReadWriteLock (TRI_read_write_lock_t* lock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif rc = pthread_rwlock_wrlock(lock); if (rc != 0) { @@ -410,9 +359,6 @@ void TRI_WriteLockReadWriteLock (TRI_read_write_lock_t* lock) { void TRI_WriteUnlockReadWriteLock (TRI_read_write_lock_t* lock) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(lock); -#endif rc = pthread_rwlock_unlock(lock); if (rc != 0) { @@ -444,9 +390,6 @@ void TRI_WriteUnlockReadWriteLock (TRI_read_write_lock_t* lock) { //////////////////////////////////////////////////////////////////////////////// void TRI_InitCondition (TRI_condition_t* cond) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif pthread_cond_init(&cond->_cond, 0); cond->_ownMutex = true; @@ -466,10 +409,6 @@ void TRI_InitCondition (TRI_condition_t* cond) { //////////////////////////////////////////////////////////////////////////////// void TRI_Init2Condition (TRI_condition_t* cond, TRI_mutex_t* mutex) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); - assert(mutex); -#endif pthread_cond_init(&cond->_cond, 0); cond->_ownMutex = false; @@ -481,9 +420,6 @@ void TRI_Init2Condition (TRI_condition_t* cond, TRI_mutex_t* mutex) { //////////////////////////////////////////////////////////////////////////////// void TRI_DestroyCondition (TRI_condition_t* cond) { -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif pthread_cond_destroy(&cond->_cond); if (cond->_ownMutex) { @@ -514,9 +450,6 @@ void TRI_DestroyCondition (TRI_condition_t* cond) { void TRI_SignalCondition (TRI_condition_t* cond) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_cond_signal(&cond->_cond); if (rc != 0) { @@ -535,9 +468,6 @@ void TRI_SignalCondition (TRI_condition_t* cond) { void TRI_BroadcastCondition (TRI_condition_t* cond) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_cond_broadcast(&cond->_cond); if (rc != 0) { @@ -556,9 +486,6 @@ void TRI_BroadcastCondition (TRI_condition_t* cond) { void TRI_WaitCondition (TRI_condition_t* cond) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_cond_wait(&cond->_cond, cond->_mutex); if (rc != 0) { @@ -596,9 +523,6 @@ bool TRI_TimedWaitCondition (TRI_condition_t* cond, uint64_t delay) { ts.tv_sec = ts.tv_sec + ((x - y) / 1000000000); // and wait -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_cond_timedwait(&cond->_cond, cond->_mutex, &ts); if (rc != 0) { @@ -621,9 +545,6 @@ bool TRI_TimedWaitCondition (TRI_condition_t* cond, uint64_t delay) { void TRI_LockCondition (TRI_condition_t* cond) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_mutex_lock(cond->_mutex); if (rc != 0) { @@ -640,9 +561,6 @@ void TRI_LockCondition (TRI_condition_t* cond) { void TRI_UnlockCondition (TRI_condition_t* cond) { int rc; -#ifdef TRI_ENABLE_LOCK_CHECK - assert(cond); -#endif rc = pthread_mutex_unlock(cond->_mutex); if (rc != 0) { diff --git a/lib/BasicsC/locks.h b/lib/BasicsC/locks.h index f447b5bc1b..efc79773c0 100644 --- a/lib/BasicsC/locks.h +++ b/lib/BasicsC/locks.h @@ -39,16 +39,6 @@ /// @{ //////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -/// @brief log a trace message for locking operations -//////////////////////////////////////////////////////////////////////////////// - -#ifdef TRI_ENABLE_LOCK_CHECK -#define TRI_LOCK_CHECK_TRACE(...) LOG_TRACE(__VA_ARGS__); -#else -#define TRI_LOCK_CHECK_TRACE(...) ; -#endif - //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/m4/configure.threads b/m4/configure.threads index abf40e1c9b..03d8d79e47 100644 --- a/m4/configure.threads +++ b/m4/configure.threads @@ -61,18 +61,3 @@ if test "x$tr_cv_broken_cxa_guard" = xyes; then AC_DEFINE([BROKEN_CXA_GUARD], [1], [static programs have broken cxa_guard]) fi -dnl ----------------------------------------------------------------------------------------- -dnl option for lock checking -dnl ----------------------------------------------------------------------------------------- - -AC_ARG_ENABLE(lock-check, - AS_HELP_STRING([--enable-lock-check], [enables lock checking (default: no)]), - tr_LOCK_CHECK="${enableval:-yes}", - tr_LOCK_CHECK=no - ) - -if test "x$tr_LOCK_CHECK" = xyes; then - AC_DEFINE_UNQUOTED(TRI_ENABLE_LOCK_CHECK, 1, [true if lock checking should be performed]) -fi - -AM_CONDITIONAL(ENABLE_LOCK_CHECK, test "x$tr_LOCK_CHECK" = xyes)