summaryrefslogtreecommitdiffstats
path: root/lib/thread.c
diff options
context:
space:
mode:
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);