mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 15:08:53 +00:00
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:
@@ -211,25 +211,6 @@ static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno,
|
|||||||
return res;
|
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,
|
static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
|
||||||
const char* mutex_name, ast_mutex_t *t)
|
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);
|
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)
|
static inline int ast_mutex_lock(ast_mutex_t *pmutex)
|
||||||
{
|
{
|
||||||
__MTX_PROF(pmutex);
|
__MTX_PROF(pmutex);
|
||||||
@@ -570,23 +537,6 @@ static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
|
|||||||
return pthread_mutex_trylock(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;
|
typedef pthread_cond_t ast_cond_t;
|
||||||
|
|
||||||
static inline int ast_cond_init(ast_cond_t *cond, pthread_condattr_t *cond_attr)
|
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 */
|
#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_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_lock use_ast_mutex_lock_instead_of_pthread_mutex_lock
|
||||||
#define pthread_mutex_unlock use_ast_mutex_unlock_instead_of_pthread_mutex_unlock
|
#define pthread_mutex_unlock use_ast_mutex_unlock_instead_of_pthread_mutex_unlock
|
||||||
|
Reference in New Issue
Block a user