summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_spec.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-04-02 03:05:39 +0000
committerjeff <jeff@FreeBSD.org>2003-04-02 03:05:39 +0000
commitbb610376a5e993ec00e22a5e13f106b3b43d90f6 (patch)
tree3edb86617f8b88a54083b0eeb1e45c1b253d05e0 /lib/libthr/thread/thr_spec.c
parentdc2ed57595804600bd48f7fa875694c5f01ec98d (diff)
downloadFreeBSD-src-bb610376a5e993ec00e22a5e13f106b3b43d90f6.zip
FreeBSD-src-bb610376a5e993ec00e22a5e13f106b3b43d90f6.tar.gz
- 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().
Diffstat (limited to 'lib/libthr/thread/thr_spec.c')
-rw-r--r--lib/libthr/thread/thr_spec.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c
index 07ef387..eefae51 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: */
OpenPOWER on IntegriCloud