aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-27 14:19:07 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-27 14:19:07 +0000
commitc70ca1fa69c9a95108664b4132b7188a686cc9e4 (patch)
tree19fa3a22f0ab1ce323bb2bfd787ffc86627196be /linuxthreads
parent91cc83ff9745491a0d6673f36df9cdabd397d748 (diff)
downloadglibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.zip
glibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.tar.gz
glibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.tar.bz2
Update.
* sysdeps/unix/sysv/linux/powerpc/pread.c: Do not use the i386 version. Instead call the system call wrapper function using an 64bit argument. * sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/pwrite.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog23
-rw-r--r--linuxthreads/attr.c68
-rw-r--r--linuxthreads/cancel.c28
-rw-r--r--linuxthreads/condvar.c50
-rw-r--r--linuxthreads/manager.c30
-rw-r--r--linuxthreads/mutex.c74
-rw-r--r--linuxthreads/pthread.c11
-rw-r--r--linuxthreads/ptlongjmp.c4
-rw-r--r--linuxthreads/rwlock.c120
-rw-r--r--linuxthreads/spinlock.c23
-rw-r--r--linuxthreads/spinlock.h4
-rw-r--r--linuxthreads/sysdeps/pthread/bits/pthreadtypes.h58
-rw-r--r--linuxthreads/sysdeps/pthread/pthread.h8
13 files changed, 263 insertions, 238 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index c0acdda..635bc63 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,26 @@
+1998-10-27 13:46 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/pthread/pthread.h (struct _pthread_cleanup_buffer): Prepend
+ __ to field names of the struct.
+ * sysdeps/pthread/bits/pthreadtypes.h (struct _pthread_fastlock):
+ Likewise.
+ (pthread_attr_t): Likewise.
+ (pthread_cond_t): Likewise.
+ (pthread_condattr_t): Likewise.
+ (pthread_mutex_t): Likewise.
+ (pthread_mutexattr_t): Likewise.
+ (pthread_rwlock_t): Likewise.
+ (pthread_rwlockattr_t): Likewise.
+ * attr.c: Adjust for pthread.h and pthreadtypes.h change.
+ * cancel.c: Likewise.
+ * condvar.c: Likewise.
+ * manager.c: Likewise.
+ * mutex.c: Likewise.
+ * pthread.c: Likewise.
+ * ptlongjmp.c: Likewise.
+ * rwlock.c: Likewise.
+ * spinlock.c: Likewise.
+
1998-10-09 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/pt-machine.h (get_eflags, set_eflags): Mark these
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index 3a19ddc..2a70ebe 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -25,15 +25,15 @@ int __pthread_attr_init_2_1(pthread_attr_t *attr)
{
size_t ps = __getpagesize ();
- attr->detachstate = PTHREAD_CREATE_JOINABLE;
- attr->schedpolicy = SCHED_OTHER;
- attr->schedparam.sched_priority = 0;
- attr->inheritsched = PTHREAD_EXPLICIT_SCHED;
- attr->scope = PTHREAD_SCOPE_SYSTEM;
- attr->guardsize = ps;
- attr->stackaddr = NULL;
- attr->stackaddr_set = 0;
- attr->stacksize = STACK_SIZE - ps;
+ attr->__detachstate = PTHREAD_CREATE_JOINABLE;
+ attr->__schedpolicy = SCHED_OTHER;
+ attr->__schedparam.sched_priority = 0;
+ attr->__inheritsched = PTHREAD_EXPLICIT_SCHED;
+ attr->__scope = PTHREAD_SCOPE_SYSTEM;
+ attr->__guardsize = ps;
+ attr->__stackaddr = NULL;
+ attr->__stackaddr_set = 0;
+ attr->__stacksize = STACK_SIZE - ps;
return 0;
}
#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
@@ -41,11 +41,11 @@ default_symbol_version (__pthread_attr_init_2_1, pthread_attr_init, GLIBC_2.1);
int __pthread_attr_init_2_0(pthread_attr_t *attr)
{
- attr->detachstate = PTHREAD_CREATE_JOINABLE;
- attr->schedpolicy = SCHED_OTHER;
- attr->schedparam.sched_priority = 0;
- attr->inheritsched = PTHREAD_EXPLICIT_SCHED;
- attr->scope = PTHREAD_SCOPE_SYSTEM;
+ attr->__detachstate = PTHREAD_CREATE_JOINABLE;
+ attr->__schedpolicy = SCHED_OTHER;
+ attr->__schedparam.sched_priority = 0;
+ attr->__inheritsched = PTHREAD_EXPLICIT_SCHED;
+ attr->__scope = PTHREAD_SCOPE_SYSTEM;
return 0;
}
symbol_version (__pthread_attr_init_2_0, pthread_attr_init, GLIBC_2.0);
@@ -63,32 +63,32 @@ int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
if (detachstate < PTHREAD_CREATE_JOINABLE ||
detachstate > PTHREAD_CREATE_DETACHED)
return EINVAL;
- attr->detachstate = detachstate;
+ attr->__detachstate = detachstate;
return 0;
}
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
{
- *detachstate = attr->detachstate;
+ *detachstate = attr->__detachstate;
return 0;
}
int pthread_attr_setschedparam(pthread_attr_t *attr,
const struct sched_param *param)
{
- int max_prio = __sched_get_priority_max(attr->schedpolicy);
- int min_prio = __sched_get_priority_min(attr->schedpolicy);
+ int max_prio = __sched_get_priority_max(attr->__schedpolicy);
+ int min_prio = __sched_get_priority_min(attr->__schedpolicy);
if (param->sched_priority < min_prio || param->sched_priority > max_prio)
return EINVAL;
- memcpy (&attr->schedparam, param, sizeof (struct sched_param));
+ memcpy (&attr->__schedparam, param, sizeof (struct sched_param));
return 0;
}
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
{
- memcpy (param, &attr->schedparam, sizeof (struct sched_param));
+ memcpy (param, &attr->__schedparam, sizeof (struct sched_param));
return 0;
}
@@ -96,13 +96,13 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
return EINVAL;
- attr->schedpolicy = policy;
+ attr->__schedpolicy = policy;
return 0;
}
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
{
- *policy = attr->schedpolicy;
+ *policy = attr->__schedpolicy;
return 0;
}
@@ -110,13 +110,13 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
if (inherit != PTHREAD_INHERIT_SCHED && inherit != PTHREAD_EXPLICIT_SCHED)
return EINVAL;
- attr->inheritsched = inherit;
+ attr->__inheritsched = inherit;
return 0;
}
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
{
- *inherit = attr->inheritsched;
+ *inherit = attr->__inheritsched;
return 0;
}
@@ -124,7 +124,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
switch (scope) {
case PTHREAD_SCOPE_SYSTEM:
- attr->scope = scope;
+ attr->__scope = scope;
return 0;
case PTHREAD_SCOPE_PROCESS:
return ENOTSUP;
@@ -135,7 +135,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
{
- *scope = attr->scope;
+ *scope = attr->__scope;
return 0;
}
@@ -147,9 +147,9 @@ int __pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
guardsize = roundup (guardsize, ps);
/* The guard size must not be larger than the stack itself */
- if (guardsize >= attr->stacksize) return EINVAL;
+ if (guardsize >= attr->__stacksize) return EINVAL;
- attr->guardsize = guardsize;
+ attr->__guardsize = guardsize;
return 0;
}
@@ -157,15 +157,15 @@ weak_alias (__pthread_attr_setguardsize, pthread_attr_setguardsize)
int __pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize)
{
- *guardsize = attr->guardsize;
+ *guardsize = attr->__guardsize;
return 0;
}
weak_alias (__pthread_attr_getguardsize, pthread_attr_getguardsize)
int __pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
{
- attr->stackaddr = stackaddr;
- attr->stackaddr_set = 1;
+ attr->__stackaddr = stackaddr;
+ attr->__stackaddr_set = 1;
return 0;
}
weak_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr)
@@ -175,7 +175,7 @@ int __pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
/* XXX This function has a stupid definition. The standard specifies
no error value but what is if no stack address was set? We simply
return the value we have in the member. */
- *stackaddr = attr->stackaddr;
+ *stackaddr = attr->__stackaddr;
return 0;
}
weak_alias (__pthread_attr_getstackaddr, pthread_attr_getstackaddr)
@@ -186,14 +186,14 @@ int __pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
if (stacksize < PTHREAD_STACK_MIN)
return EINVAL;
- attr->stacksize = stacksize;
+ attr->__stacksize = stacksize;
return 0;
}
weak_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize)
int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
{
- *stacksize = attr->stacksize;
+ *stacksize = attr->__stacksize;
return 0;
}
weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize)
diff --git a/linuxthreads/cancel.c b/linuxthreads/cancel.c
index e9cb10c..3ff5954 100644
--- a/linuxthreads/cancel.c
+++ b/linuxthreads/cancel.c
@@ -77,9 +77,9 @@ void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
void (*routine)(void *), void * arg)
{
pthread_descr self = thread_self();
- buffer->routine = routine;
- buffer->arg = arg;
- buffer->prev = THREAD_GETMEM(self, p_cleanup);
+ buffer->__routine = routine;
+ buffer->__arg = arg;
+ buffer->__prev = THREAD_GETMEM(self, p_cleanup);
THREAD_SETMEM(self, p_cleanup, buffer);
}
@@ -87,18 +87,18 @@ void _pthread_cleanup_pop(struct _pthread_cleanup_buffer * buffer,
int execute)
{
pthread_descr self = thread_self();
- if (execute) buffer->routine(buffer->arg);
- THREAD_SETMEM(self, p_cleanup, buffer->prev);
+ if (execute) buffer->__routine(buffer->__arg);
+ THREAD_SETMEM(self, p_cleanup, buffer->__prev);
}
void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
void (*routine)(void *), void * arg)
{
pthread_descr self = thread_self();
- buffer->routine = routine;
- buffer->arg = arg;
- buffer->canceltype = THREAD_GETMEM(self, p_canceltype);
- buffer->prev = THREAD_GETMEM(self, p_cleanup);
+ buffer->__routine = routine;
+ buffer->__arg = arg;
+ buffer->__canceltype = THREAD_GETMEM(self, p_canceltype);
+ buffer->__prev = THREAD_GETMEM(self, p_cleanup);
THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
THREAD_SETMEM(self, p_cleanup, buffer);
}
@@ -107,9 +107,9 @@ void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
int execute)
{
pthread_descr self = thread_self();
- if (execute) buffer->routine(buffer->arg);
- THREAD_SETMEM(self, p_cleanup, buffer->prev);
- THREAD_SETMEM(self, p_canceltype, buffer->canceltype);
+ if (execute) buffer->__routine(buffer->__arg);
+ THREAD_SETMEM(self, p_cleanup, buffer->__prev);
+ THREAD_SETMEM(self, p_canceltype, buffer->__canceltype);
if (THREAD_GETMEM(self, p_canceled) &&
THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE &&
THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
@@ -120,8 +120,8 @@ void __pthread_perform_cleanup(void)
{
pthread_descr self = thread_self();
struct _pthread_cleanup_buffer * c;
- for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->prev)
- c->routine(c->arg);
+ for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
+ c->__routine(c->__arg);
}
#ifndef PIC
diff --git a/linuxthreads/condvar.c b/linuxthreads/condvar.c
index 773d714..b880a38 100644
--- a/linuxthreads/condvar.c
+++ b/linuxthreads/condvar.c
@@ -28,14 +28,14 @@
int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *cond_attr)
{
- __pthread_init_lock(&cond->c_lock);
- cond->c_waiting = NULL;
+ __pthread_init_lock(&cond->__c_lock);
+ cond->__c_waiting = NULL;
return 0;
}
int pthread_cond_destroy(pthread_cond_t *cond)
{
- if (cond->c_waiting != NULL) return EBUSY;
+ if (cond->__c_waiting != NULL) return EBUSY;
return 0;
}
@@ -43,9 +43,9 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
volatile pthread_descr self = thread_self();
- __pthread_lock(&cond->c_lock);
- enqueue(&cond->c_waiting, self);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ enqueue(&cond->__c_waiting, self);
+ __pthread_unlock(&cond->__c_lock);
pthread_mutex_unlock(mutex);
suspend_with_cancellation(self);
pthread_mutex_lock(mutex);
@@ -53,9 +53,9 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
if (THREAD_GETMEM(self, p_canceled)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
/* Remove ourselves from the waiting queue if we're still on it */
- __pthread_lock(&cond->c_lock);
- remove_from_queue(&cond->c_waiting, self);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ remove_from_queue(&cond->__c_waiting, self);
+ __pthread_unlock(&cond->__c_lock);
pthread_exit(PTHREAD_CANCELED);
}
return 0;
@@ -72,9 +72,9 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
sigjmp_buf jmpbuf;
/* Wait on the condition */
- __pthread_lock(&cond->c_lock);
- enqueue(&cond->c_waiting, self);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ enqueue(&cond->__c_waiting, self);
+ __pthread_unlock(&cond->__c_lock);
pthread_mutex_unlock(mutex);
/* Set up a longjmp handler for the restart and cancel signals */
if (sigsetjmp(jmpbuf, 1) == 0) {
@@ -107,17 +107,17 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
/* This is a cancellation point */
if (THREAD_GETMEM(self, p_canceled)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
- __pthread_lock(&cond->c_lock);
- remove_from_queue(&cond->c_waiting, self);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ remove_from_queue(&cond->__c_waiting, self);
+ __pthread_unlock(&cond->__c_lock);
pthread_mutex_lock(mutex);
pthread_exit(PTHREAD_CANCELED);
}
/* If not signaled: also remove ourselves and return an error code */
if (THREAD_GETMEM(self, p_signal) == 0) {
- __pthread_lock(&cond->c_lock);
- remove_from_queue(&cond->c_waiting, self);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ remove_from_queue(&cond->__c_waiting, self);
+ __pthread_unlock(&cond->__c_lock);
pthread_mutex_lock(mutex);
return retsleep == 0 ? ETIMEDOUT : EINTR;
}
@@ -147,9 +147,9 @@ int pthread_cond_signal(pthread_cond_t *cond)
{
pthread_descr th;
- __pthread_lock(&cond->c_lock);
- th = dequeue(&cond->c_waiting);
- __pthread_unlock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
+ th = dequeue(&cond->__c_waiting);
+ __pthread_unlock(&cond->__c_lock);
if (th != NULL) restart(th);
return 0;
}
@@ -158,11 +158,11 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
{
pthread_descr tosignal, th;
- __pthread_lock(&cond->c_lock);
+ __pthread_lock(&cond->__c_lock);
/* Copy the current state of the waiting queue and empty it */
- tosignal = cond->c_waiting;
- cond->c_waiting = NULL;
- __pthread_unlock(&cond->c_lock);
+ tosignal = cond->__c_waiting;
+ cond->__c_waiting = NULL;
+ __pthread_unlock(&cond->__c_lock);
/* Now signal each process in the queue */
while ((th = dequeue(&tosignal)) != NULL) restart(th);
return 0;
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index d145395..b6107da 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -222,12 +222,12 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
char * guardaddr;
size_t stacksize, guardsize;
- if (attr != NULL && attr->stackaddr_set)
+ if (attr != NULL && attr->__stackaddr_set)
{
/* The user provided a stack. */
new_thread =
- (pthread_descr) ((long)(attr->stackaddr) & -sizeof(void *)) - 1;
- new_thread_bottom = (char *) attr->stackaddr - attr->stacksize;
+ (pthread_descr) ((long)(attr->__stackaddr) & -sizeof(void *)) - 1;
+ new_thread_bottom = (char *) attr->__stackaddr - attr->__stacksize;
guardaddr = NULL;
guardsize = 0;
}
@@ -249,9 +249,9 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
the RLIMIT_STACK soft limit prevents stacks from
running into one another. */
if (attr == NULL ||
- attr->guardsize == 0 ||
- (attr->guardsize == pagesize &&
- attr->stacksize == STACK_SIZE - pagesize))
+ attr->__guardsize == 0 ||
+ (attr->__guardsize == pagesize &&
+ attr->__stacksize == STACK_SIZE - pagesize))
{
/* We don't need a guard page. */
guardaddr = NULL;
@@ -260,11 +260,11 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
else
{
/* Put a bad page at the bottom of the stack */
- stacksize = roundup(attr->stacksize, pagesize);
+ stacksize = roundup(attr->__stacksize, pagesize);
if (stacksize >= STACK_SIZE - pagesize)
stacksize = STACK_SIZE - pagesize;
guardaddr = (void *)new_thread - stacksize;
- guardsize = attr->guardsize;
+ guardsize = attr->__guardsize;
if (mmap ((caddr_t) guardaddr, guardsize, 0, MAP_FIXED, -1, 0)
== MAP_FAILED)
{
@@ -298,7 +298,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
we can do this. Normally this should be done by examining the
return value of the __sched_setscheduler call in pthread_start_thread
but this is hard to implement. FIXME */
- if (attr != NULL && attr->schedpolicy != SCHED_OTHER && geteuid () != 0)
+ if (attr != NULL && attr->__schedpolicy != SCHED_OTHER && geteuid () != 0)
return EPERM;
/* Find a free segment for the thread, and allocate a stack if needed */
for (sseg = 2; ; sseg++)
@@ -324,7 +324,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
new_thread->p_signal_jmp = NULL;
new_thread->p_cancel_jmp = NULL;
new_thread->p_terminated = 0;
- new_thread->p_detached = attr == NULL ? 0 : attr->detachstate;
+ new_thread->p_detached = attr == NULL ? 0 : attr->__detachstate;
new_thread->p_exited = 0;
new_thread->p_retval = NULL;
new_thread->p_joining = NULL;
@@ -340,7 +340,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
new_thread->p_sigwaiting = 0;
new_thread->p_guardaddr = guardaddr;
new_thread->p_guardsize = guardsize;
- new_thread->p_userstack = attr != NULL && attr->stackaddr_set;
+ new_thread->p_userstack = attr != NULL && attr->__stackaddr_set;
memset (new_thread->p_specific, '\0',
PTHREAD_KEY_1STLEVEL_SIZE * sizeof (new_thread->p_specific[0]));
new_thread->p_self = new_thread;
@@ -352,10 +352,10 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
/* Determine scheduling parameters for the thread */
new_thread->p_start_args.schedpolicy = -1;
if (attr != NULL) {
- switch(attr->inheritsched) {
+ switch(attr->__inheritsched) {
case PTHREAD_EXPLICIT_SCHED:
- new_thread->p_start_args.schedpolicy = attr->schedpolicy;
- memcpy (&new_thread->p_start_args.schedparam, &attr->schedparam,
+ new_thread->p_start_args.schedpolicy = attr->__schedpolicy;
+ memcpy (&new_thread->p_start_args.schedparam, &attr->__schedparam,
sizeof (struct sched_param));
break;
case PTHREAD_INHERIT_SCHED:
@@ -382,7 +382,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
/* Check if cloning succeeded */
if (pid == -1) {
/* Free the stack if we allocated it */
- if (attr == NULL || !attr->stackaddr_set)
+ if (attr == NULL || !attr->__stackaddr_set)
{
munmap((caddr_t)((char *)(new_thread+1) - INITIAL_STACK_SIZE),
INITIAL_STACK_SIZE);
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index 74b0922..d3ef78c 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -26,18 +26,18 @@
int __pthread_mutex_init(pthread_mutex_t * mutex,
const pthread_mutexattr_t * mutex_attr)
{
- __pthread_init_lock(&mutex->m_lock);
- mutex->m_kind =
- mutex_attr == NULL ? PTHREAD_MUTEX_FAST_NP : mutex_attr->mutexkind;
- mutex->m_count = 0;
- mutex->m_owner = NULL;
+ __pthread_init_lock(&mutex->__m_lock);
+ mutex->__m_kind =
+ mutex_attr == NULL ? PTHREAD_MUTEX_FAST_NP : mutex_attr->__mutexkind;
+ mutex->__m_count = 0;
+ mutex->__m_owner = NULL;
return 0;
}
weak_alias (__pthread_mutex_init, pthread_mutex_init)
int __pthread_mutex_destroy(pthread_mutex_t * mutex)
{
- if (mutex->m_lock.status != 0) return EBUSY;
+ if (mutex->__m_lock.__status != 0) return EBUSY;
return 0;
}
weak_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
@@ -47,26 +47,26 @@ int __pthread_mutex_trylock(pthread_mutex_t * mutex)
pthread_descr self;
int retcode;
- switch(mutex->m_kind) {
+ switch(mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
- retcode = __pthread_trylock(&mutex->m_lock);
+ retcode = __pthread_trylock(&mutex->__m_lock);
return retcode;
case PTHREAD_MUTEX_RECURSIVE_NP:
self = thread_self();
- if (mutex->m_owner == self) {
- mutex->m_count++;
+ if (mutex->__m_owner == self) {
+ mutex->__m_count++;
return 0;
}
- retcode = __pthread_trylock(&mutex->m_lock);
+ retcode = __pthread_trylock(&mutex->__m_lock);
if (retcode == 0) {
- mutex->m_owner = self;
- mutex->m_count = 0;
+ mutex->__m_owner = self;
+ mutex->__m_count = 0;
}
return retcode;
case PTHREAD_MUTEX_ERRORCHECK_NP:
- retcode = __pthread_trylock(&mutex->m_lock);
+ retcode = __pthread_trylock(&mutex->__m_lock);
if (retcode == 0) {
- mutex->m_owner = thread_self();
+ mutex->__m_owner = thread_self();
}
return retcode;
default:
@@ -79,25 +79,25 @@ int __pthread_mutex_lock(pthread_mutex_t * mutex)
{
pthread_descr self;
- switch(mutex->m_kind) {
+ switch(mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
- __pthread_lock(&mutex->m_lock);
+ __pthread_lock(&mutex->__m_lock);
return 0;
case PTHREAD_MUTEX_RECURSIVE_NP:
self = thread_self();
- if (mutex->m_owner == self) {
- mutex->m_count++;
+ if (mutex->__m_owner == self) {
+ mutex->__m_count++;
return 0;
}
- __pthread_lock(&mutex->m_lock);
- mutex->m_owner = self;
- mutex->m_count = 0;
+ __pthread_lock(&mutex->__m_lock);
+ mutex->__m_owner = self;
+ mutex->__m_count = 0;
return 0;
case PTHREAD_MUTEX_ERRORCHECK_NP:
self = thread_self();
- if (mutex->m_owner == self) return EDEADLK;
- __pthread_lock(&mutex->m_lock);
- mutex->m_owner = self;
+ if (mutex->__m_owner == self) return EDEADLK;
+ __pthread_lock(&mutex->__m_lock);
+ mutex->__m_owner = self;
return 0;
default:
return EINVAL;
@@ -107,23 +107,23 @@ weak_alias (__pthread_mutex_lock, pthread_mutex_lock)
int __pthread_mutex_unlock(pthread_mutex_t * mutex)
{
- switch (mutex->m_kind) {
+ switch (mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
- __pthread_unlock(&mutex->m_lock);
+ __pthread_unlock(&mutex->__m_lock);
return 0;
case PTHREAD_MUTEX_RECURSIVE_NP:
- if (mutex->m_count > 0) {
- mutex->m_count--;
+ if (mutex->__m_count > 0) {
+ mutex->__m_count--;
return 0;
}
- mutex->m_owner = NULL;
- __pthread_unlock(&mutex->m_lock);
+ mutex->__m_owner = NULL;
+ __pthread_unlock(&mutex->__m_lock);
return 0;
case PTHREAD_MUTEX_ERRORCHECK_NP:
- if (mutex->m_owner != thread_self() || mutex->m_lock.status == 0)
+ if (mutex->__m_owner != thread_self() || mutex->__m_lock.__status == 0)
return EPERM;
- mutex->m_owner = NULL;
- __pthread_unlock(&mutex->m_lock);
+ mutex->__m_owner = NULL;
+ __pthread_unlock(&mutex->__m_lock);
return 0;
default:
return EINVAL;
@@ -133,7 +133,7 @@ weak_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
int __pthread_mutexattr_init(pthread_mutexattr_t *attr)
{
- attr->mutexkind = PTHREAD_MUTEX_FAST_NP;
+ attr->__mutexkind = PTHREAD_MUTEX_FAST_NP;
return 0;
}
weak_alias (__pthread_mutexattr_init, pthread_mutexattr_init)
@@ -150,7 +150,7 @@ int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
&& kind != PTHREAD_MUTEX_RECURSIVE_NP
&& kind != PTHREAD_MUTEX_ERRORCHECK_NP)
return EINVAL;
- attr->mutexkind = kind;
+ attr->__mutexkind = kind;
return 0;
}
weak_alias (__pthread_mutexattr_settype, pthread_mutexattr_settype)
@@ -159,7 +159,7 @@ weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
int __pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
{
- *kind = attr->mutexkind;
+ *kind = attr->__mutexkind;
return 0;
}
weak_alias (__pthread_mutexattr_gettype, pthread_mutexattr_gettype)
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index c7cfdac..d0c66d0 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -340,11 +340,12 @@ int __pthread_create_2_0(pthread_t *thread, const pthread_attr_t *attr,
{
size_t ps = __getpagesize ();
- memcpy (&new_attr, attr, (size_t) &(((pthread_attr_t*)NULL)->guardsize));
- new_attr.guardsize = ps;
- new_attr.stackaddr_set = 0;
- new_attr.stackaddr = NULL;
- new_attr.stacksize = STACK_SIZE - ps;
+ memcpy (&new_attr, attr,
+ (size_t) &(((pthread_attr_t*)NULL)->__guardsize));
+ new_attr.__guardsize = ps;
+ new_attr.__stackaddr_set = 0;
+ new_attr.__stackaddr = NULL;
+ new_attr.__stacksize = STACK_SIZE - ps;
attr = &new_attr;
}
return __pthread_create_2_1 (thread, attr, start_routine, arg);
diff --git a/linuxthreads/ptlongjmp.c b/linuxthreads/ptlongjmp.c
index 7e4314e..1c12508 100644
--- a/linuxthreads/ptlongjmp.c
+++ b/linuxthreads/ptlongjmp.c
@@ -34,8 +34,8 @@ static void pthread_cleanup_upto(__jmp_buf target)
for (c = THREAD_GETMEM(self, p_cleanup);
c != NULL && _JMPBUF_UNWINDS(target, c);
- c = c->prev)
- c->routine(c->arg);
+ c = c->__prev)
+ c->__routine(c->__arg);
THREAD_SETMEM(self, p_cleanup, c);
if (THREAD_GETMEM(self, p_in_sighandler)
&& _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler)))
diff --git a/linuxthreads/rwlock.c b/linuxthreads/rwlock.c
index 99209f7..bff4e38 100644
--- a/linuxthreads/rwlock.c
+++ b/linuxthreads/rwlock.c
@@ -30,21 +30,21 @@ int
pthread_rwlock_init (pthread_rwlock_t *rwlock,
const pthread_rwlockattr_t *attr)
{
- __pthread_init_lock(&rwlock->rw_lock);
- rwlock->rw_readers = 0;
- rwlock->rw_writer = NULL;
- rwlock->rw_read_waiting = NULL;
- rwlock->rw_write_waiting = NULL;
+ __pthread_init_lock(&rwlock->__rw_lock);
+ rwlock->__rw_readers = 0;
+ rwlock->__rw_writer = NULL;
+ rwlock->__rw_read_waiting = NULL;
+ rwlock->__rw_write_waiting = NULL;
if (attr == NULL)
{
- rwlock->rw_kind = PTHREAD_RWLOCK_DEFAULT_NP;
- rwlock->rw_pshared = PTHREAD_PROCESS_PRIVATE;
+ rwlock->__rw_kind = PTHREAD_RWLOCK_DEFAULT_NP;
+ rwlock->__rw_pshared = PTHREAD_PROCESS_PRIVATE;
}
else
{
- rwlock->rw_kind = attr->lockkind;
- rwlock->rw_pshared = attr->pshared;
+ rwlock->__rw_kind = attr->__lockkind;
+ rwlock->__rw_pshared = attr->__pshared;
}
return 0;
@@ -57,10 +57,10 @@ pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
int readers;
_pthread_descr writer;
- __pthread_lock (&rwlock->rw_lock);
- readers = rwlock->rw_readers;
- writer = rwlock->rw_writer;
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_lock (&rwlock->__rw_lock);
+ readers = rwlock->__rw_readers;
+ writer = rwlock->__rw_writer;
+ __pthread_unlock (&rwlock->__rw_lock);
if (readers > 0 || writer != NULL)
return EBUSY;
@@ -76,22 +76,22 @@ pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
while (1)
{
- __pthread_lock (&rwlock->rw_lock);
- if (rwlock->rw_writer == NULL
- || (rwlock->rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
- && rwlock->rw_readers != 0))
+ __pthread_lock (&rwlock->__rw_lock);
+ if (rwlock->__rw_writer == NULL
+ || (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
+ && rwlock->__rw_readers != 0))
/* We can add a reader lock. */
break;
/* Suspend ourselves, then try again */
self = thread_self ();
- enqueue (&rwlock->rw_read_waiting, self);
- __pthread_unlock (&rwlock->rw_lock);
+ enqueue (&rwlock->__rw_read_waiting, self);
+ __pthread_unlock (&rwlock->__rw_lock);
suspend (self); /* This is not a cancellation point */
}
- ++rwlock->rw_readers;
- __pthread_unlock (&rwlock->rw_lock);
+ ++rwlock->__rw_readers;
+ __pthread_unlock (&rwlock->__rw_lock);
return 0;
}
@@ -102,15 +102,15 @@ pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
{
int result = EBUSY;
- __pthread_lock (&rwlock->rw_lock);
- if (rwlock->rw_writer == NULL
- || (rwlock->rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
- && rwlock->rw_readers != 0))
+ __pthread_lock (&rwlock->__rw_lock);
+ if (rwlock->__rw_writer == NULL
+ || (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
+ && rwlock->__rw_readers != 0))
{
- ++rwlock->rw_readers;
+ ++rwlock->__rw_readers;
result = 0;
}
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
return result;
}
@@ -123,17 +123,17 @@ pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
while(1)
{
- __pthread_lock (&rwlock->rw_lock);
- if (rwlock->rw_readers == 0 && rwlock->rw_writer == NULL)
+ __pthread_lock (&rwlock->__rw_lock);
+ if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL)
{
- rwlock->rw_writer = self;
- __pthread_unlock (&rwlock->rw_lock);
+ rwlock->__rw_writer = self;
+ __pthread_unlock (&rwlock->__rw_lock);
return 0;
}
/* Suspend ourselves, then try again */
- enqueue (&rwlock->rw_write_waiting, self);
- __pthread_unlock (&rwlock->rw_lock);
+ enqueue (&rwlock->__rw_write_waiting, self);
+ __pthread_unlock (&rwlock->__rw_lock);
suspend (self); /* This is not a cancellation point */
}
}
@@ -144,13 +144,13 @@ pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
{
int result = EBUSY;
- __pthread_lock (&rwlock->rw_lock);
- if (rwlock->rw_readers == 0 && rwlock->rw_writer == NULL)
+ __pthread_lock (&rwlock->__rw_lock);
+ if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL)
{
- rwlock->rw_writer = thread_self ();
+ rwlock->__rw_writer = thread_self ();
result = 0;
}
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
return result;
}
@@ -162,51 +162,51 @@ pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
pthread_descr torestart;
pthread_descr th;
- __pthread_lock (&rwlock->rw_lock);
- if (rwlock->rw_writer != NULL)
+ __pthread_lock (&rwlock->__rw_lock);
+ if (rwlock->__rw_writer != NULL)
{
/* Unlocking a write lock. */
- if (rwlock->rw_writer != thread_self ())
+ if (rwlock->__rw_writer != thread_self ())
{
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
return EPERM;
}
- rwlock->rw_writer = NULL;
+ rwlock->__rw_writer = NULL;
- if (rwlock->rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
- || (th = dequeue (&rwlock->rw_write_waiting)) == NULL)
+ if (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP
+ || (th = dequeue (&rwlock->__rw_write_waiting)) == NULL)
{
/* Restart all waiting readers. */
- torestart = rwlock->rw_read_waiting;
- rwlock->rw_read_waiting = NULL;
- __pthread_unlock (&rwlock->rw_lock);
+ torestart = rwlock->__rw_read_waiting;
+ rwlock->__rw_read_waiting = NULL;
+ __pthread_unlock (&rwlock->__rw_lock);
while ((th = dequeue (&torestart)) != NULL)
restart (th);
}
else
{
/* Restart one waiting writer. */
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
restart (th);
}
}
else
{
/* Unlocking a read lock. */
- if (rwlock->rw_readers == 0)
+ if (rwlock->__rw_readers == 0)
{
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
return EPERM;
}
- --rwlock->rw_readers;
- if (rwlock->rw_readers == 0)
+ --rwlock->__rw_readers;
+ if (rwlock->__rw_readers == 0)
/* Restart one waiting writer, if any. */
- th = dequeue (&rwlock->rw_write_waiting);
+ th = dequeue (&rwlock->__rw_write_waiting);
else
th = NULL;
- __pthread_unlock (&rwlock->rw_lock);
+ __pthread_unlock (&rwlock->__rw_lock);
if (th != NULL)
restart (th);
}
@@ -219,8 +219,8 @@ pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
int
pthread_rwlockattr_init (pthread_rwlockattr_t *attr)
{
- attr->lockkind = 0;
- attr->pshared = 0;
+ attr->__lockkind = 0;
+ attr->__pshared = 0;
return 0;
}
@@ -236,7 +236,7 @@ pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr)
int
pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *attr, int *pshared)
{
- *pshared = attr->pshared;
+ *pshared = attr->__pshared;
return 0;
}
@@ -247,7 +247,7 @@ pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared)
if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED)
return EINVAL;
- attr->pshared = pshared;
+ attr->__pshared = pshared;
return 0;
}
@@ -256,7 +256,7 @@ pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared)
int
pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *attr, int *pref)
{
- *pref = attr->lockkind;
+ *pref = attr->__lockkind;
return 0;
}
@@ -269,7 +269,7 @@ pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *attr, int pref)
&& pref != PTHREAD_RWLOCK_DEFAULT_NP)
return EINVAL;
- attr->lockkind = pref;
+ attr->__lockkind = pref;
return 0;
}
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 15faec0..172cb7a 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -42,7 +42,7 @@ void __pthread_lock(struct _pthread_fastlock * lock)
pthread_descr self = NULL;
do {
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus == 0) {
newstatus = 1;
} else {
@@ -51,8 +51,8 @@ void __pthread_lock(struct _pthread_fastlock * lock)
}
if (self != NULL)
THREAD_SETMEM(self, p_nextwaiting, (pthread_descr) oldstatus);
- } while(! compare_and_swap(&lock->status, oldstatus, newstatus,
- &lock->spinlock));
+ } while(! compare_and_swap(&lock->__status, oldstatus, newstatus,
+ &lock->__spinlock));
if (oldstatus != 0) suspend(self);
}
@@ -61,9 +61,9 @@ int __pthread_trylock(struct _pthread_fastlock * lock)
long oldstatus;
do {
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus != 0) return EBUSY;
- } while(! compare_and_swap(&lock->status, 0, 1, &lock->spinlock));
+ } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock));
return 0;
}
@@ -74,14 +74,15 @@ void __pthread_unlock(struct _pthread_fastlock * lock)
int maxprio;
again:
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus == 1) {
/* No threads are waiting for this lock */
- if (! compare_and_swap(&lock->status, 1, 0, &lock->spinlock)) goto again;
+ if (! compare_and_swap(&lock->__status, 1, 0, &lock->__spinlock))
+ goto again;
return;
}
/* Find thread in waiting queue with maximal priority */
- ptr = (pthread_descr *) &lock->status;
+ ptr = (pthread_descr *) &lock->__status;
thr = (pthread_descr) oldstatus;
maxprio = 0;
maxptr = ptr;
@@ -94,13 +95,13 @@ again:
thr = *ptr;
}
/* Remove max prio thread from waiting list. */
- if (maxptr == (pthread_descr *) &lock->status) {
+ if (maxptr == (pthread_descr *) &lock->__status) {
/* If max prio thread is at head, remove it with compare-and-swap
to guard against concurrent lock operation */
thr = (pthread_descr) oldstatus;
- if (! compare_and_swap(&lock->status,
+ if (! compare_and_swap(&lock->__status,
oldstatus, (long)(thr->p_nextwaiting),
- &lock->spinlock))
+ &lock->__spinlock))
goto again;
} else {
/* No risk of concurrent access, remove max prio thread normally */
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h
index d21a967..a6f682c 100644
--- a/linuxthreads/spinlock.h
+++ b/linuxthreads/spinlock.h
@@ -20,8 +20,8 @@ extern void __pthread_unlock(struct _pthread_fastlock * lock);
static inline void __pthread_init_lock(struct _pthread_fastlock * lock)
{
- lock->status = 0;
- lock->spinlock = 0;
+ lock->__status = 0;
+ lock->__spinlock = 0;
}
#define LOCK_INITIALIZER {0, 0}
diff --git a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
index 20b0bed..04dbe35 100644
--- a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
+++ b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
@@ -25,8 +25,8 @@
/* Fast locks (not abstract because mutexes and conditions aren't abstract). */
struct _pthread_fastlock
{
- long int status; /* "Free" or "taken" or head of waiting list */
- int spinlock; /* For compare-and-swap emulation */
+ long int __status; /* "Free" or "taken" or head of waiting list */
+ int __spinlock; /* For compare-and-swap emulation */
};
/* Thread descriptors */
@@ -36,30 +36,30 @@ typedef struct _pthread_descr_struct *_pthread_descr;
/* Attributes for threads. */
typedef struct
{
- int detachstate;
- int schedpolicy;
- struct __sched_param schedparam;
- int inheritsched;
- int scope;
- size_t guardsize;
- int stackaddr_set;
- void *stackaddr;
- size_t stacksize;
+ int __detachstate;
+ int __schedpolicy;
+ struct __sched_param __schedparam;
+ int __inheritsched;
+ int __scope;
+ size_t __guardsize;
+ int __stackaddr_set;
+ void *__stackaddr;
+ size_t __stacksize;
} pthread_attr_t;
/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
typedef struct
{
- struct _pthread_fastlock c_lock; /* Protect against concurrent access */
- _pthread_descr c_waiting; /* Threads waiting on this condition */
+ struct _pthread_fastlock __c_lock; /* Protect against concurrent access */
+ _pthread_descr __c_waiting; /* Threads waiting on this condition */
} pthread_cond_t;
/* Attribute for conditionally variables. */
typedef struct
{
- int dummy;
+ int __dummy;
} pthread_condattr_t;
/* Keys for thread-specific data */
@@ -71,18 +71,18 @@ typedef unsigned int pthread_key_t;
with earlier releases of LinuxThreads.) */
typedef struct
{
- int m_reserved; /* Reserved for future use */
- int m_count; /* Depth of recursive locking */
- _pthread_descr m_owner; /* Owner thread (if recursive or errcheck) */
- int m_kind; /* Mutex kind: fast, recursive or errcheck */
- struct _pthread_fastlock m_lock; /* Underlying fast lock */
+ int __m_reserved; /* Reserved for future use */
+ int __m_count; /* Depth of recursive locking */
+ _pthread_descr __m_owner; /* Owner thread (if recursive or errcheck) */
+ int __m_kind; /* Mutex kind: fast, recursive or errcheck */
+ struct _pthread_fastlock __m_lock; /* Underlying fast lock */
} pthread_mutex_t;
/* Attribute for mutex. */
typedef struct
{
- int mutexkind;
+ int __mutexkind;
} pthread_mutexattr_t;
@@ -94,21 +94,21 @@ typedef int pthread_once_t;
/* Read-write locks. */
typedef struct
{
- struct _pthread_fastlock rw_lock; /* Lock to guarantee mutual exclusion */
- int rw_readers; /* Number of readers */
- _pthread_descr rw_writer; /* Identity of writer, or NULL if none */
- _pthread_descr rw_read_waiting; /* Threads waiting for reading */
- _pthread_descr rw_write_waiting; /* Threads waiting for writing */
- int rw_kind; /* Reader/Writer preference selection */
- int rw_pshared; /* Shared between processes or not */
+ struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */
+ int __rw_readers; /* Number of readers */
+ _pthread_descr __rw_writer; /* Identity of writer, or NULL if none */
+ _pthread_descr __rw_read_waiting; /* Threads waiting for reading */
+ _pthread_descr __rw_write_waiting; /* Threads waiting for writing */
+ int __rw_kind; /* Reader/Writer preference selection */
+ int __rw_pshared; /* Shared between processes or not */
} pthread_rwlock_t;
/* Attribute for read-write locks. */
typedef struct
{
- int lockkind;
- int pshared;
+ int __lockkind;
+ int __pshared;
} pthread_rwlockattr_t;
#endif
diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h
index 6d2bd0f..bc6c691 100644
--- a/linuxthreads/sysdeps/pthread/pthread.h
+++ b/linuxthreads/sysdeps/pthread/pthread.h
@@ -107,10 +107,10 @@ enum
struct _pthread_cleanup_buffer
{
- void (*routine) __PMT ((void *)); /* Function to call. */
- void *arg; /* Its argument. */
- int canceltype; /* Saved cancellation type. */
- struct _pthread_cleanup_buffer *prev; /* Chaining of cleanup functions. */
+ void (*__routine) __PMT ((void *)); /* Function to call. */
+ void *__arg; /* Its argument. */
+ int __canceltype; /* Saved cancellation type. */
+ struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */
};
/* Cancellation */