Remove ABI differences that occured when compiling with DEBUG_THREADS.

"Bad Things" would happen if Asterisk was compiled with DEBUG_THREADS, but a
loaded module was not (or vice versa).  This also immensely simplifies the
lock code, since there are no longer 2 separate versions of them.

Review: https://reviewboard.asterisk.org/r/508/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2010-04-22 19:08:01 +00:00
parent a753e8878b
commit 9e3f5fa6fb
8 changed files with 1517 additions and 1632 deletions

View File

@@ -209,8 +209,6 @@ void *ast_heap_peek(struct ast_heap *h, unsigned int index);
*/
size_t ast_heap_size(struct ast_heap *h);
#ifndef DEBUG_THREADS
/*!
* \brief Write-Lock a heap
*
@@ -223,7 +221,7 @@ size_t ast_heap_size(struct ast_heap *h);
* \return see the documentation for pthread_rwlock_wrlock()
* \since 1.6.1
*/
int ast_heap_wrlock(struct ast_heap *h);
int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line);
/*!
* \brief Read-Lock a heap
@@ -237,7 +235,7 @@ int ast_heap_wrlock(struct ast_heap *h);
* \return see the documentation for pthread_rwlock_rdlock()
* \since 1.6.1
*/
int ast_heap_rdlock(struct ast_heap *h);
int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line);
/*!
* \brief Unlock a heap
@@ -247,18 +245,11 @@ int ast_heap_rdlock(struct ast_heap *h);
* \return see the documentation for pthread_rwlock_unlock()
* \since 1.6.1
*/
int ast_heap_unlock(struct ast_heap *h);
#else /* DEBUG_THREADS */
#define ast_heap_wrlock(h) __ast_heap_wrlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line);
#define ast_heap_rdlock(h) __ast_heap_rdlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line);
#define ast_heap_unlock(h) __ast_heap_unlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line);
#endif /* DEBUG_THREADS */
#define ast_heap_wrlock(h) __ast_heap_wrlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define ast_heap_rdlock(h) __ast_heap_rdlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define ast_heap_unlock(h) __ast_heap_unlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
/*!
* \brief Verify that a heap has been properly constructed