diff options
| author | Jafar Al-Gharaibeh <Jafaral@users.noreply.github.com> | 2017-06-30 10:00:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-30 10:00:43 -0500 |
| commit | b5a46fd2a6e047576ad6869e4fb4c4ac10fd3773 (patch) | |
| tree | 147c039267a5b8ada019adccbcab8bbede446c4a /lib/log.c | |
| parent | 801ec168a41bbeed2d2935d0e396396356873cba (diff) | |
| parent | 26eb0e4ff5031e791b4fd23d397dc15e1beab8d1 (diff) | |
Merge pull request #723 from qlyoung/fix-static-pipe-poker-buf
lib: more multithreading infra work
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"); } |
