Use a lock for debug messages to ensure non-currupted message-lines.

This commit is contained in:
MelwareDE 2005-07-16 12:04:48 +00:00
parent bdc08177b3
commit 91b4ab5a4f
2 changed files with 4 additions and 0 deletions

View File

@ -86,6 +86,7 @@ AST_MUTEX_DEFINE_STATIC(pipelock);
AST_MUTEX_DEFINE_STATIC(monlock);
AST_MUTEX_DEFINE_STATIC(contrlock);
AST_MUTEX_DEFINE_STATIC(capi_put_lock);
AST_MUTEX_DEFINE_EXPORTED(verbose_lock);
#ifdef CAPI_ULAW
static int capi_capability = AST_FORMAT_ULAW;

View File

@ -27,6 +27,7 @@
extern unsigned ast_capi_ApplID;
extern _cword get_ast_capi_MessageNumber(void);
extern int capidebug;
extern ast_mutex_t verbose_lock;
extern int capi_call(struct ast_channel *c, char *idest, int timeout);
extern int capi_detect_dtmf(struct ast_channel *c, int flag);
@ -39,7 +40,9 @@ extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
do { \
if ((o_v == 0) || (option_verbose > o_v)) { \
if ((!c_d) || ((c_d) && (capidebug))) { \
ast_mutex_lock(&verbose_lock); \
ast_verbose(text); \
ast_mutex_unlock(&verbose_lock); \
} \
} \
} while(0)