From 26f52e2f8b92ffea807005dc15866b2cf79ed3ac Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Wed, 2 Apr 2003 03:05:39 +0000 Subject: - Define curthread as _get_curthread() and remove all direct calls to _get_curthread(). This is similar to the kernel's curthread. Doing this saves stack overhead and is more convenient to the programmer. - Pass the pointer to the newly created thread to _thread_init(). - Remove _get_curthread_slow(). --- lib/libthr/thread/thr_spec.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib/libthr/thread/thr_spec.c') diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c index 07ef3875b365..eefae51d0085 100644 --- a/lib/libthr/thread/thr_spec.c +++ b/lib/libthr/thread/thr_spec.c @@ -102,7 +102,6 @@ _pthread_key_delete(pthread_key_t key) void _thread_cleanupspecific(void) { - struct pthread *curthread = _get_curthread(); void *data = NULL; int key; int itr; @@ -165,11 +164,8 @@ pthread_key_allocate_data(void) int _pthread_setspecific(pthread_key_t key, const void *value) { - struct pthread *pthread; int ret = 0; - - /* Point to the running thread: */ - pthread = _get_curthread(); + pthread_t pthread = curthread; if ((pthread->specific) || (pthread->specific = pthread_key_allocate_data())) { @@ -198,12 +194,9 @@ _pthread_setspecific(pthread_key_t key, const void *value) void * _pthread_getspecific(pthread_key_t key) { - struct pthread *pthread; + pthread_t pthread = curthread; void *data; - /* Point to the running thread: */ - pthread = _get_curthread(); - /* Check if there is specific data: */ if (pthread->specific != NULL && key < PTHREAD_KEYS_MAX) { /* Check if this key has been used before: */ -- cgit v1.2.3