From 4165d44d7026bb2572d4cdfe27f8fec348b4089a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 25 Jun 2003 00:00:50 +0000 Subject: Update. * include/time.h: Define CLOCK_IDFIELD_SIZE. * sysdeps/posix/clock_getres.c: Recognize thread CPU clock IDs. * sysdeps/unix/clock_gettime.c: Likewise. * sysdeps/unix/clock_settime.c: Likewise. * sysdeps/unix/clock_nanosleep.c (CPUCLOCK_P): Adjust for new clock id for thread CPU clocks. --- nptl/allocatestack.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'nptl/allocatestack.c') diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 48a47205f8..223f0e445d 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -654,3 +654,50 @@ __reclaim_stacks (void) /* Initialize the lock. */ stack_cache_lock = LLL_LOCK_INITIALIZER; } + + +#if HP_TIMING_AVAIL +/* Find a thread given the thread ID. */ +struct pthread * +attribute_hidden +__find_thread_by_id (pid_t tid) +{ + struct pthread *result = NULL; + + lll_lock (stack_cache_lock); + + /* Iterate over the list with system-allocated threads first. */ + list_t *runp; + list_for_each (runp, &stack_used) + { + struct pthread *curp; + + curp = list_entry (runp, struct pthread, list); + + if (curp->tid == tid) + { + result = curp; + goto out; + } + } + + /* Now the list with threads using user-allocated stacks. */ + list_for_each (runp, &__stack_user) + { + struct pthread *curp; + + curp = list_entry (runp, struct pthread, list); + + if (curp->tid == tid) + { + result = curp; + goto out; + } + } + + out: + lll_unlock (stack_cache_lock); + + return result; +} +#endif -- cgit v1.2.3