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
+3 -15
View File
@@ -472,12 +472,8 @@ int __ao2_ref(void *o, int delta);
* \param a A pointer to the object we want to lock.
* \return 0 on success, other values on error.
*/
#ifndef DEBUG_THREADS
int ao2_lock(void *a);
#else
#define ao2_lock(a) __ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
int __ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
#endif
#define ao2_lock(a) __ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
/*! \brief
* Unlock an object.
@@ -485,12 +481,8 @@ int __ao2_lock(void *a, const char *file, const char *func, int line, const char
* \param a A pointer to the object we want unlock.
* \return 0 on success, other values on error.
*/
#ifndef DEBUG_THREADS
int ao2_unlock(void *a);
#else
#define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
#endif
#define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
/*! \brief
* Try locking-- (don't block if fail)
@@ -498,12 +490,8 @@ int __ao2_unlock(void *a, const char *file, const char *func, int line, const ch
* \param a A pointer to the object we want to lock.
* \return 0 on success, other values on error.
*/
#ifndef DEBUG_THREADS
int ao2_trylock(void *a);
#else
#define ao2_trylock(a) __ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
int __ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
#endif
#define ao2_trylock(a) __ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
/*!
* \brief Return the lock address of an object
+5 -14
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
+133 -1533
View File
File diff suppressed because it is too large Load Diff
+2 -10
View File
@@ -111,19 +111,11 @@ int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((d
* thread which requests it. Note that all connections should be released
* when the thread is done by calling odbc_release_obj(), below.
*/
#ifdef DEBUG_THREADS
struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags, const char *file, const char *function, int lineno);
#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#else
struct odbc_obj *ast_odbc_request_obj2(const char *name, struct ast_flags flags);
#endif
#ifdef DEBUG_THREADS
struct odbc_obj *_ast_odbc_request_obj(const char *name, int check, const char *file, const char *function, int lineno);
#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define ast_odbc_request_obj(a, b) _ast_odbc_request_obj(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#else
struct odbc_obj *ast_odbc_request_obj(const char *name, int check);
#endif
/*!
* \brief Retrieve a stored ODBC object, if a transaction has been started.