From 15c2043021cc17276cdd34a76c55dddd8105cc96 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 22 Dec 2005 06:49:49 +0000 Subject: more consistently use _rthread prefix for all not meant to be exported interfaces that aren't static, and a few that are but which will change --- lib/librthread/rthread.c | 30 +++++++++++++++--------------- lib/librthread/rthread.h | 4 ++-- lib/librthread/rthread_sync.c | 8 ++++---- lib/librthread/rthread_tls.c | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c index 2781977e5a5..45cc51e5416 100644 --- a/lib/librthread/rthread.c +++ b/lib/librthread/rthread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.c,v 1.16 2005/12/22 06:33:12 tedu Exp $ */ +/* $OpenBSD: rthread.c,v 1.17 2005/12/22 06:49:48 tedu Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst * All Rights Reserved. @@ -68,7 +68,7 @@ _spinunlock(_spinlock_lock_t *lock) } static pthread_t -thread_findself(void) +_rthread_findself(void) { pthread_t me; pid_t tid = getthrid(); @@ -82,7 +82,7 @@ thread_findself(void) static void -thread_start(void *v) +_rthread_start(void *v) { pthread_t thread = v; void *retval; @@ -95,9 +95,9 @@ thread_start(void *v) } static int -thread_init(void) +_rthread_init(void) { - pthread_t thread = &inital_thread; + pthread_t thread = &initial_thread; extern int __isthreaded; printf("rthread init\n"); @@ -114,7 +114,7 @@ thread_init(void) } static struct stack * -alloc_stack(size_t len, void *base) +_rthread_alloc_stack(size_t len, void *base) { struct stack *stack; @@ -141,7 +141,7 @@ alloc_stack(size_t len, void *base) } static void -free_stack(struct stack *stack) +_rthread_free_stack(struct stack *stack) { munmap(stack->base, stack->len); free(stack); @@ -156,11 +156,11 @@ pthread_self(void) pthread_t thread; if (!threads_ready) - if (thread_init()) + if (_rthread_init()) return (NULL); _spinlock(&thread_lock); - thread = thread_findself(); + thread = _rthread_findself(); _spinunlock(&thread_lock); return (thread); @@ -182,7 +182,7 @@ pthread_exit(void *retval) oclfn->fn(oclfn->arg); free(oclfn); } - rthread_tls_destructors(thread); + _rthread_tls_destructors(thread); #if 0 if (thread->flags & THREAD_DETACHED) free(thread); @@ -225,14 +225,14 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, int rc = 0; if (!threads_ready) - if ((rc = thread_init())) + if ((rc = _rthread_init())) return (rc); thread = malloc(sizeof(*thread)); if (!thread) return (errno); memset(thread, 0, sizeof(*thread)); - thread->stack = alloc_stack(64 * 1024, NULL); + thread->stack = _rthread_alloc_stack(64 * 1024, NULL); if (!thread->stack) { rc = errno; goto fail1; @@ -248,12 +248,12 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, thread_list = thread; tid = rfork_thread(RFPROC | RFTHREAD | RFMEM | RFNOWAIT, - thread->stack->sp, thread_start, thread); + thread->stack->sp, _rthread_start, thread); if (tid == -1) { rc = errno; goto fail2; } - /* new thread will appear thread_start */ + /* new thread will appear _rthread_start */ thread->tid = tid; thread->flags |= THREAD_CANCEL_ENABLE|THREAD_CANCEL_DEFERRED; *threadp = thread; @@ -263,7 +263,7 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, fail2: thread_list = thread->next; _spinunlock(&thread_lock); - free_stack(thread->stack); + _rthread_free_stack(thread->stack); fail1: free(thread); diff --git a/lib/librthread/rthread.h b/lib/librthread/rthread.h index 6da13075dfd..626daddb49c 100644 --- a/lib/librthread/rthread.h +++ b/lib/librthread/rthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.h,v 1.9 2005/12/19 21:30:10 marco Exp $ */ +/* $OpenBSD: rthread.h,v 1.10 2005/12/22 06:49:48 tedu Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst * All Rights Reserved. @@ -125,6 +125,6 @@ int _sem_post(sem_t); int _sem_wakeup(sem_t); int _sem_wakeall(sem_t); -void rthread_tls_destructors(pthread_t); +void _rthread_tls_destructors(pthread_t); int _atomic_lock(register volatile _spinlock_lock_t *); diff --git a/lib/librthread/rthread_sync.c b/lib/librthread/rthread_sync.c index d821372c0e7..012312754c4 100644 --- a/lib/librthread/rthread_sync.c +++ b/lib/librthread/rthread_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_sync.c,v 1.11 2005/12/19 06:47:40 tedu Exp $ */ +/* $OpenBSD: rthread_sync.c,v 1.12 2005/12/22 06:49:48 tedu Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst * All Rights Reserved. @@ -253,7 +253,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutexp) } int -rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait) +_rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait) { pthread_mutex_t mutex = *mutexp; pthread_t thread = pthread_self(); @@ -281,13 +281,13 @@ rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait) int pthread_mutex_lock(pthread_mutex_t *p) { - return (rthread_mutex_lock(p, 0)); + return (_rthread_mutex_lock(p, 0)); } int pthread_mutex_trylock(pthread_mutex_t *p) { - return (rthread_mutex_lock(p, 1)); + return (_rthread_mutex_lock(p, 1)); } int diff --git a/lib/librthread/rthread_tls.c b/lib/librthread/rthread_tls.c index a2e747d2c0f..c4484982285 100644 --- a/lib/librthread/rthread_tls.c +++ b/lib/librthread/rthread_tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_tls.c,v 1.8 2005/12/19 06:47:40 tedu Exp $ */ +/* $OpenBSD: rthread_tls.c,v 1.9 2005/12/22 06:49:48 tedu Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst * All Rights Reserved. @@ -84,7 +84,7 @@ pthread_key_delete(pthread_key_t key) } static struct rthread_storage * -rthread_findstorage(pthread_key_t key) +_rthread_findstorage(pthread_key_t key) { struct rthread_storage *rs; pthread_t self; @@ -114,7 +114,7 @@ pthread_getspecific(pthread_key_t key) { struct rthread_storage *rs; - rs = rthread_findstorage(key); + rs = _rthread_findstorage(key); if (!rs) return (NULL); @@ -126,7 +126,7 @@ pthread_setspecific(pthread_key_t key, const void *data) { struct rthread_storage *rs; - rs = rthread_findstorage(key); + rs = _rthread_findstorage(key); if (!rs) return (ENOMEM); rs->data = (void *)data; -- cgit v1.2.3