summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorJeff Peeler <jpeeler@digium.com>2010-12-12 03:58:33 +0000
committerJeff Peeler <jpeeler@digium.com>2010-12-12 03:58:33 +0000
commit78bd0de1a91c751c6b495b97994ffbc39173ca27 (patch)
tree4f29a663898cf85e15ac911b9a1378b0ca5beccf /main/asterisk.c
parentcc541e6852338468565470fbd78a7e76115033a5 (diff)
Add support for several platforms to obtain the real thread ID.
Already had the pthread ID which is not the same. The most obvious enhancement is in the "core show threads" output. As stated in the utils header, if the platform isn't supported -1 is reported (instead of the process ID previously). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index e5c530a53..4ef727138 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -379,6 +379,7 @@ struct thread_list_t {
AST_RWLIST_ENTRY(thread_list_t) list;
char *name;
pthread_t id;
+ int lwp;
};
static AST_RWLIST_HEAD_STATIC(thread_list, thread_list_t);
@@ -390,6 +391,7 @@ void ast_register_thread(char *name)
if (!new)
return;
new->id = pthread_self();
+ new->lwp = ast_get_tid();
new->name = name; /* steal the allocated memory for the thread name */
AST_RWLIST_WRLOCK(&thread_list);
AST_RWLIST_INSERT_HEAD(&thread_list, new, list);
@@ -516,7 +518,7 @@ static char *handle_show_threads(struct ast_cli_entry *e, int cmd, struct ast_cl
AST_RWLIST_RDLOCK(&thread_list);
AST_RWLIST_TRAVERSE(&thread_list, cur, list) {
- ast_cli(a->fd, "%p %s\n", (void *)cur->id, cur->name);
+ ast_cli(a->fd, "%p %d %s\n", (void *)cur->id, cur->lwp, cur->name);
count++;
}
AST_RWLIST_UNLOCK(&thread_list);