diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-15 18:05:19 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-30 01:32:15 +0200 |
commit | e0bebc7c223abf239b5ccda1c2de42a2b0410455 (patch) | |
tree | c8f3d876bc81c5d34c5966177bff2ccdeaec09c0 /lib/log.c | |
parent | lib: un-static trash buffer for pipe poker (diff) | |
download | frr-e0bebc7c223abf239b5ccda1c2de42a2b0410455.tar.xz frr-e0bebc7c223abf239b5ccda1c2de42a2b0410455.zip |
lib: mt-safe tracebacks
can't be using them statics anymore sonny
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/log.c')
-rw-r--r-- | lib/log.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -509,16 +509,18 @@ zlog_signal(int signo, const char *action ); s = buf; - if (!thread_current) + struct thread *tc; + tc = pthread_getspecific (thread_current); + if (!tc) s = str_append (LOC, "no thread information available\n"); else { s = str_append (LOC, "in thread "); - s = str_append (LOC, thread_current->funcname); + s = str_append (LOC, tc->funcname); s = str_append (LOC, " scheduled from "); - s = str_append (LOC, thread_current->schedfrom); + s = str_append (LOC, tc->schedfrom); s = str_append (LOC, ":"); - s = num_append (LOC, thread_current->schedfrom_line); + s = num_append (LOC, tc->schedfrom_line); s = str_append (LOC, "\n"); } @@ -700,10 +702,13 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG) void zlog_thread_info (int log_level) { - if (thread_current) + struct thread *tc; + tc = pthread_getspecific (thread_current); + + if (tc) zlog(log_level, "Current thread function %s, scheduled from " - "file %s, line %u", thread_current->funcname, - thread_current->schedfrom, thread_current->schedfrom_line); + "file %s, line %u", tc->funcname, + tc->schedfrom, tc->schedfrom_line); else zlog(log_level, "Current thread not known/applicable"); } |