diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-15 21:28:55 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-15 21:28:55 +0000 |
commit | 3e1f32b0ff8178ed7e2e0b0943aec6df376badca (patch) | |
tree | e4979806bcbcdb97488f677117a8865123ec4225 /main/sched.c | |
parent | b0bc4317224e4287a4a362097df173899fc1a5af (diff) |
Merged revisions 175882 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r175882 | russell | 2009-02-15 15:27:33 -0600 (Sun, 15 Feb 2009) | 2 lines
Make ast_sched_report() and ast_sched_dump() thread safe.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@175890 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/sched.c')
-rw-r--r-- | main/sched.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/main/sched.c b/main/sched.c index 55823cb0e..7210b9a1d 100644 --- a/main/sched.c +++ b/main/sched.c @@ -394,6 +394,7 @@ void ast_sched_report(struct sched_context *con, struct ast_str **buf, struct as ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt); + ast_mutex_lock(&con->lock); AST_DLLIST_TRAVERSE(&con->schedq, cur, list) { /* match the callback to the cblist */ for (i = 0; i < cbnames->numassocs; i++) { @@ -407,6 +408,7 @@ void ast_sched_report(struct sched_context *con, struct ast_str **buf, struct as countlist[cbnames->numassocs]++; } } + ast_mutex_unlock(&con->lock); for (i = 0; i < cbnames->numassocs; i++) { ast_str_append(buf, 0, " %s : %d\n", cbnames->list[i], countlist[i]); @@ -416,7 +418,7 @@ void ast_sched_report(struct sched_context *con, struct ast_str **buf, struct as } /*! \brief Dump the contents of the scheduler to LOG_DEBUG */ -void ast_sched_dump(const struct sched_context *con) +void ast_sched_dump(struct sched_context *con) { struct sched *q; struct timeval when = ast_tvnow(); @@ -429,6 +431,7 @@ void ast_sched_dump(const struct sched_context *con) ast_debug(1, "=============================================================\n"); ast_debug(1, "|ID Callback Data Time (sec:ms) |\n"); ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n"); + ast_mutex_lock(&con->lock); AST_DLLIST_TRAVERSE(&con->schedq, q, list) { struct timeval delta = ast_tvsub(q->when, when); @@ -439,8 +442,8 @@ void ast_sched_dump(const struct sched_context *con) (long)delta.tv_sec, (long int)delta.tv_usec); } + ast_mutex_unlock(&con->lock); ast_debug(1, "=============================================================\n"); - } /*! \brief |