diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-06 13:50:15 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-06 13:50:15 +0000 |
commit | 0862156dc17379a29e8783fd2f7c352583911130 (patch) | |
tree | ab410fff7ba2d00c94502bc17ed15ccf1ec140d4 /include/asterisk | |
parent | 1eb7f30e6f4ed4bdb94dee8026a5c7f072703905 (diff) |
Remove some checks to see if locks are initialized from the non-DEBUG_THREADS
versions of the lock routines. These are incorrect for a number of reasons:
- It breaks the build on mac.
- If there is a problem with locks not getting initialized, then the proper
fix is to find that place and fix the code so that it does get initialized.
- If additional debug code is needed to help find the problem areas, then this
type of things should _only_ be put in the DEBUG_THREADS wrappers.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@88931 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/lock.h | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 14f432ac2..b9d7d06ec 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -675,11 +675,6 @@ static inline int ast_mutex_init(ast_mutex_t *pmutex) int res; pthread_mutexattr_t attr; -#ifdef BSD - /* Check for already init'ed mutex for BSD */ - if (*pmutex != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) - return 0; -#endif /* BSD */ pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, AST_MUTEX_KIND); @@ -692,42 +687,21 @@ static inline int ast_mutex_init(ast_mutex_t *pmutex) static inline int ast_mutex_unlock(ast_mutex_t *pmutex) { -#ifdef BSD - /* Check for uninitialized mutex for BSD */ - if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) { - ast_mutex_init(pmutex); - return 0; - } -#endif /* BSD */ return pthread_mutex_unlock(pmutex); } static inline int ast_mutex_destroy(ast_mutex_t *pmutex) { -#ifdef BSD - if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) - return 0; -#endif /* BSD */ return pthread_mutex_destroy(pmutex); } static inline int ast_mutex_lock(ast_mutex_t *pmutex) { -#ifdef BSD - /* Check for uninitialized mutex for BSD */ - if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) - ast_mutex_init(pmutex); -#endif /* BSD */ __MTX_PROF(pmutex); } static inline int ast_mutex_trylock(ast_mutex_t *pmutex) { -#ifdef BSD - /* Check for uninitialized mutex for BSD */ - if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) - ast_mutex_init(pmutex); -#endif /* BSD */ return pthread_mutex_trylock(pmutex); } @@ -1037,11 +1011,6 @@ static inline int ast_rwlock_init(ast_rwlock_t *prwlock) int res; pthread_rwlockattr_t attr; -#ifdef BSD - /* Check for already init'ed lock for BSD */ - if (*prwlock != ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) - return 0; -#endif /* BSD */ pthread_rwlockattr_init(&attr); #ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP @@ -1055,67 +1024,31 @@ static inline int ast_rwlock_init(ast_rwlock_t *prwlock) static inline int ast_rwlock_destroy(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized mutex for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) - return 0; -#endif /* BSD */ return pthread_rwlock_destroy(prwlock); } static inline int ast_rwlock_unlock(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized lock for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) { - ast_rwlock_init(prwlock); - return 0; - } -#endif /* BSD */ return pthread_rwlock_unlock(prwlock); } static inline int ast_rwlock_rdlock(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized lock for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) { - ast_rwlock_init(prwlock); - } -#endif /* BSD */ return pthread_rwlock_rdlock(prwlock); } static inline int ast_rwlock_tryrdlock(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized lock for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) { - ast_rwlock_init(prwlock); - } -#endif /* BSD */ return pthread_rwlock_tryrdlock(prwlock); } static inline int ast_rwlock_wrlock(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized lock for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) { - ast_rwlock_init(prwlock); - } -#endif /* BSD */ return pthread_rwlock_wrlock(prwlock); } static inline int ast_rwlock_trywrlock(ast_rwlock_t *prwlock) { -#ifdef BSD - /* Check for uninitialized lock for BSD */ - if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) { - ast_rwlock_init(prwlock); - } -#endif /* BSD */ return pthread_rwlock_trywrlock(prwlock); } #endif /* !DEBUG_THREADS */ |