diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-06-25 00:00:50 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-06-25 00:00:50 +0000 |
commit | 4165d44d7026bb2572d4cdfe27f8fec348b4089a (patch) | |
tree | 911aa068d7d9c4205ad6a4965ce156c937fed219 /nptl/allocatestack.c | |
parent | 51d1ca00fd1ddc2ed77b615b7a23ecdf3e8a55a9 (diff) | |
download | glibc-4165d44d7026bb2572d4cdfe27f8fec348b4089a.tar.gz glibc-4165d44d7026bb2572d4cdfe27f8fec348b4089a.tar.xz glibc-4165d44d7026bb2572d4cdfe27f8fec348b4089a.zip |
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.
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r-- | nptl/allocatestack.c | 47 |
1 files changed, 47 insertions, 0 deletions
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 |