don't need two copies of this

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2006-09-18 22:14:09 +00:00
parent 7b43316cbc
commit 734a3d356e

View File

@@ -211,25 +211,6 @@ static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno,
return res;
}
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
/* If AST_MUTEX_INIT_W_CONSTRUCTORS is defined, use file scope
constructors/destructors to create/destroy mutexes. */
#define __AST_MUTEX_DEFINE(scope, mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE; \
static void __attribute__ ((constructor)) init_##mutex(void) \
{ \
ast_mutex_init(&mutex); \
} \
static void __attribute__ ((destructor)) fini_##mutex(void) \
{ \
ast_mutex_destroy(&mutex); \
}
#else /* !AST_MUTEX_INIT_W_CONSTRUCTORS */
/* By default, use static initialization of mutexes. */
#define __AST_MUTEX_DEFINE(scope, mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
const char* mutex_name, ast_mutex_t *t)
{
@@ -546,20 +527,6 @@ static inline int ast_mutex_destroy(ast_mutex_t *pmutex)
return pthread_mutex_destroy(pmutex);
}
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
/* if AST_MUTEX_INIT_W_CONSTRUCTORS is defined, use file scope
constructors/destructors to create/destroy mutexes. */
#define __AST_MUTEX_DEFINE(scope,mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE; \
static void __attribute__ ((constructor)) init_##mutex(void) \
{ \
ast_mutex_init(&mutex); \
} \
static void __attribute__ ((destructor)) fini_##mutex(void) \
{ \
ast_mutex_destroy(&mutex); \
}
static inline int ast_mutex_lock(ast_mutex_t *pmutex)
{
__MTX_PROF(pmutex);
@@ -570,23 +537,6 @@ static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
return pthread_mutex_trylock(pmutex);
}
#else
/* By default, use static initialization of mutexes.*/
#define __AST_MUTEX_DEFINE(scope, mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
static inline int ast_mutex_lock(ast_mutex_t *pmutex)
{
__MTX_PROF(pmutex);
}
static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
{
return pthread_mutex_trylock(pmutex);
}
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
typedef pthread_cond_t ast_cond_t;
static inline int ast_cond_init(ast_cond_t *cond, pthread_condattr_t *cond_attr)
@@ -621,6 +571,25 @@ static inline int ast_cond_timedwait(ast_cond_t *cond, ast_mutex_t *t, const str
#endif /* !DEBUG_THREADS */
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
/* If AST_MUTEX_INIT_W_CONSTRUCTORS is defined, use file scope
constructors/destructors to create/destroy mutexes. */
#define __AST_MUTEX_DEFINE(scope, mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE; \
static void __attribute__ ((constructor)) init_##mutex(void) \
{ \
ast_mutex_init(&mutex); \
} \
static void __attribute__ ((destructor)) fini_##mutex(void) \
{ \
ast_mutex_destroy(&mutex); \
}
#else /* !AST_MUTEX_INIT_W_CONSTRUCTORS */
/* By default, use static initialization of mutexes. */
#define __AST_MUTEX_DEFINE(scope, mutex) \
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
#define pthread_mutex_t use_ast_mutex_t_instead_of_pthread_mutex_t
#define pthread_mutex_lock use_ast_mutex_lock_instead_of_pthread_mutex_lock
#define pthread_mutex_unlock use_ast_mutex_unlock_instead_of_pthread_mutex_unlock