summaryrefslogtreecommitdiffstats
path: root/lib/thread.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2013-11-18 23:52:02 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2014-09-15 18:38:56 +0200
commit615f9f18fc025757a255f936748fc1e86e922783 (patch)
treeb9cd79ef71984932f4eb5f73437f9593ad2a2604 /lib/thread.c
parent3493b7731b750cbc62f00be94b624a08ccccf0b2 (diff)
downloadquagga-615f9f18fc025757a255f936748fc1e86e922783.tar.bz2
quagga-615f9f18fc025757a255f936748fc1e86e922783.tar.xz
lib: include thread information in backtraces
now that we know what thread we're currently executing, let's add that information to SEGV / assert backtraces. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 9de5f94f..9c3ee823 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1217,6 +1217,8 @@ thread_getrusage (RUSAGE_T *r)
#endif /* HAVE_CLOCK_MONOTONIC */
}
+struct thread *thread_current = NULL;
+
/* We check thread consumed time. If the system has getrusage, we'll
use that to get in-depth stats on the performance of the thread in addition
to wall clock time stats from gettimeofday. */
@@ -1246,7 +1248,9 @@ thread_call (struct thread *thread)
GETRUSAGE (&before);
thread->real = before.real;
+ thread_current = thread;
(*thread->func) (thread);
+ thread_current = NULL;
GETRUSAGE (&after);