|
|
|
@ -91,6 +91,8 @@ struct ast_mutex_info {
|
|
|
|
|
|
|
|
|
|
typedef struct ast_mutex_info ast_mutex_t;
|
|
|
|
|
|
|
|
|
|
typedef pthread_cond_t ast_cond_t;
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno, const char *func,
|
|
|
|
|
const char *mutex_name, ast_mutex_t *t,
|
|
|
|
|
pthread_mutexattr_t *attr)
|
|
|
|
@ -341,8 +343,33 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_init(const char *filename, int lineno, const char *func,
|
|
|
|
|
const char *cond_name, ast_cond_t *cond, pthread_condattr_t *cond_attr)
|
|
|
|
|
{
|
|
|
|
|
return pthread_cond_init(cond, cond_attr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_signal(const char *filename, int lineno, const char *func,
|
|
|
|
|
const char *cond_name, ast_cond_t *cond)
|
|
|
|
|
{
|
|
|
|
|
return pthread_cond_signal(cond);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_broadcast(const char *filename, int lineno, const char *func,
|
|
|
|
|
const char *cond_name, ast_cond_t *cond)
|
|
|
|
|
{
|
|
|
|
|
return pthread_cond_broadcast(cond);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_destroy(const char *filename, int lineno, const char *func,
|
|
|
|
|
const char *cond_name, ast_cond_t *cond)
|
|
|
|
|
{
|
|
|
|
|
return pthread_cond_destroy(cond);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_wait(const char *filename, int lineno, const char *func,
|
|
|
|
|
pthread_cond_t *cond, const char *mutex_name, ast_mutex_t *t)
|
|
|
|
|
const char *cond_name, const char *mutex_name,
|
|
|
|
|
ast_cond_t *cond, ast_mutex_t *t)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
int canlog = strcmp(filename, "logger.c");
|
|
|
|
@ -400,8 +427,8 @@ static inline int __ast_pthread_cond_wait(const char *filename, int lineno, cons
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __ast_pthread_cond_timedwait(const char *filename, int lineno, const char *func,
|
|
|
|
|
pthread_cond_t *cond, const struct timespec *abstime,
|
|
|
|
|
const char *mutex_name, ast_mutex_t *t)
|
|
|
|
|
const char *cond_name, const char *mutex_name, ast_cond_t *cond,
|
|
|
|
|
ast_mutex_t *t, const struct timespec *abstime)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
int canlog = strcmp(filename, "logger.c");
|
|
|
|
@ -459,22 +486,16 @@ static inline int __ast_pthread_cond_timedwait(const char *filename, int lineno,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define ast_mutex_init(pmutex) __ast_pthread_mutex_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
|
|
|
|
|
#define ast_pthread_mutex_init(pmutex,attr) __ast_pthread_mutex_init_attr(__FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex, attr)
|
|
|
|
|
#define ast_mutex_destroy(a) __ast_pthread_mutex_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
|
|
|
|
|
#define ast_mutex_lock(a) __ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
|
|
|
|
|
#define ast_mutex_unlock(a) __ast_pthread_mutex_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
|
|
|
|
|
#define ast_mutex_trylock(a) __ast_pthread_mutex_trylock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
|
|
|
|
|
#define ast_pthread_cond_wait(cond, a) __ast_pthread_cond_wait(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, #a, a)
|
|
|
|
|
#define ast_pthread_cond_timedwait(cond, a, t) __ast_pthread_cond_timedwait(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, t, #a, a)
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
#define pthread_mutex_trylock use_ast_mutex_trylock_instead_of_pthread_mutex_trylock
|
|
|
|
|
#define pthread_mutex_init use_ast_pthread_mutex_init_instead_of_pthread_mutex_init
|
|
|
|
|
#define pthread_mutex_destroy use_ast_pthread_mutex_destroy_instead_of_pthread_mutex_destroy
|
|
|
|
|
#define pthread_cond_wait use_ast_pthread_cond_wait_instead_of_pthread_cond_wait
|
|
|
|
|
#define pthread_cond_timedwait use_ast_pthread_cond_wait_instead_of_pthread_cond_timedwait
|
|
|
|
|
#define ast_cond_init(cond, attr) __ast_pthread_cond_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond, attr)
|
|
|
|
|
#define ast_cond_destroy(cond) __ast_pthread_cond_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
|
|
|
|
|
#define ast_cond_signal(cond) __ast_pthread_cond_signal(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
|
|
|
|
|
#define ast_cond_broadcast(cond) __ast_pthread_cond_broadcast(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
|
|
|
|
|
#define ast_cond_wait(cond, mutex) __ast_pthread_cond_wait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex)
|
|
|
|
|
#define ast_cond_timedwait(cond, mutex, time) __ast_pthread_cond_timedwait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex, time)
|
|
|
|
|
|
|
|
|
|
#else /* !DEBUG_THREADS */
|
|
|
|
|
|
|
|
|
@ -540,11 +561,31 @@ static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
|
|
|
|
|
#define ast_mutex_trylock(pmutex) pthread_mutex_trylock(pmutex)
|
|
|
|
|
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
|
|
|
|
|
|
|
|
|
|
#define ast_pthread_cond_wait pthread_cond_wait
|
|
|
|
|
#define ast_pthread_cond_timedwait pthread_cond_timedwait
|
|
|
|
|
typedef pthread_cond_t ast_cond_t
|
|
|
|
|
|
|
|
|
|
#define ast_cond_init pthread_cond_init
|
|
|
|
|
#define ast_cond_destroy pthread_cond_destroy
|
|
|
|
|
#define ast_cond_signal pthread_cond_signal
|
|
|
|
|
#define ast_cond_broadcast pthread_cond_broadcast
|
|
|
|
|
#define ast_cond_wait pthread_cond_wait
|
|
|
|
|
#define ast_cond_timedwait pthread_cond_timedwait
|
|
|
|
|
|
|
|
|
|
#endif /* !DEBUG_THREADS */
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
#define pthread_mutex_trylock use_ast_mutex_trylock_instead_of_pthread_mutex_trylock
|
|
|
|
|
#define pthread_mutex_init use_ast_mutex_init_instead_of_pthread_mutex_init
|
|
|
|
|
#define pthread_mutex_destroy use_ast_mutex_destroy_instead_of_pthread_mutex_destroy
|
|
|
|
|
#define pthread_cond_t use_ast_cond_t_instead_of_pthread_cond_t
|
|
|
|
|
#define pthread_cond_init use_ast_cond_init_instead_of_pthread_cond_init
|
|
|
|
|
#define pthread_cond_destroy use_ast_cond_destroy_instead_of_pthread_cond_destroy
|
|
|
|
|
#define pthread_cond_signal use_ast_cond_signal_instead_of_pthread_cond_signal
|
|
|
|
|
#define pthread_cond_broadcast use_ast_cond_broadcast_instead_of_pthread_cond_broadcast
|
|
|
|
|
#define pthread_cond_wait use_ast_cond_wait_instead_of_pthread_cond_wait
|
|
|
|
|
#define pthread_cond_timedwait use_ast_cond_wait_instead_of_pthread_cond_timedwait
|
|
|
|
|
|
|
|
|
|
#define AST_MUTEX_DEFINE_STATIC(mutex) __AST_MUTEX_DEFINE(static,mutex)
|
|
|
|
|
#define AST_MUTEX_DEFINE_EXPORTED(mutex) __AST_MUTEX_DEFINE(/**/,mutex)
|
|
|
|
|
|
|
|
|
|