diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-06-21 04:35:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-06-21 04:35:29 +0000 |
commit | 697568d1b48a497024bca234483a157cee79c7a2 (patch) | |
tree | 890f34b715a2a1fdbeaa1307e676e49ea15d3632 /linuxthreads/sysdeps/pthread | |
parent | 1b97149de806a27fe8f52cd5841c252df168a5b8 (diff) | |
download | glibc-697568d1b48a497024bca234483a157cee79c7a2.tar glibc-697568d1b48a497024bca234483a157cee79c7a2.tar.gz glibc-697568d1b48a497024bca234483a157cee79c7a2.tar.bz2 glibc-697568d1b48a497024bca234483a157cee79c7a2.zip |
Update.
2000-06-20 Jes Sorensen <jes@linuxcare.com>
* sysdeps/unix/sysv/linux/ia64/syscalls.list: New file.
2000-06-20 Jes Sorensen <jes@linuxcare.com>
* sysdeps/unix/sysv/linux/ia64/machine-gmon.h: New file.
* sysdeps/unix/sysv/linux/ia64/profil-counter.h: New file.
2000-06-20 David Mosberger-Tang <davidm@hpl.hp.com>
* sysdeps/unix/sysv/linux/ia64/getpagesize.c: New file.
2000-06-20 Jes Sorensen <jes@linuxcare.com>
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Fix typo.
Diffstat (limited to 'linuxthreads/sysdeps/pthread')
-rw-r--r-- | linuxthreads/sysdeps/pthread/bits/pthreadtypes.h | 14 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/pthread.h | 30 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/timer_create.c | 16 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/timer_delete.c | 15 |
4 files changed, 59 insertions, 16 deletions
diff --git a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h index 99e56d23ee..a53889f5f0 100644 --- a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h +++ b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h @@ -118,6 +118,20 @@ typedef struct #ifdef __USE_XOPEN2K /* POSIX spinlock data type. */ typedef volatile int pthread_spinlock_t; + +/* POSIX barrier. */ +typedef struct { + struct _pthread_fastlock __ba_lock; /* Lock to guarantee mutual exclusion */ + int __ba_required; /* Threads needed for completion */ + int __ba_present; /* Threads waiting */ + _pthread_descr __ba_waiting; /* Queue of waiting threads */ +} pthread_barrier_t; + +/* barrier attribute */ +typedef struct { + int __pshared; +} pthread_barrierattr_t; + #endif diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h index e82c4deb99..da39e7a923 100644 --- a/linuxthreads/sysdeps/pthread/pthread.h +++ b/linuxthreads/sysdeps/pthread/pthread.h @@ -109,6 +109,13 @@ enum #define PTHREAD_ONCE_INIT 0 +/* Special constants */ + +#ifdef __USE_XOPEN2K +/* -1 is distinct from 0 and all errno constants */ +# define PTHREAD_BARRIER_SERIAL_THREAD -1 +#endif + /* Cleanup buffers */ struct _pthread_cleanup_buffer @@ -414,7 +421,7 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, #endif #ifdef __USE_XOPEN2K -/* The IEEE Std. 10003.1j-2000 introduces functions to implement +/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */ /* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can @@ -433,6 +440,27 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW; /* Release spinlock LOCK. */ extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW; + + +/* Barriers are a also a new feature in 1003.1j-2000. */ + +extern int pthread_barrier_init (pthread_barrier_t *__barrier, + __const pthread_barrierattr_t *__attr, + unsigned int __count) __THROW; + +extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW; + +extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW; + +extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW; + +extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *__attr, + int *__pshared) __THROW; + +extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, + int __pshared) __THROW; + +extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW; #endif diff --git a/linuxthreads/sysdeps/pthread/timer_create.c b/linuxthreads/sysdeps/pthread/timer_create.c index cbefb91831..1dccd30361 100644 --- a/linuxthreads/sysdeps/pthread/timer_create.c +++ b/linuxthreads/sysdeps/pthread/timer_create.c @@ -46,7 +46,7 @@ timer_create (clock_id, evp, timerid) #endif ) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -54,7 +54,7 @@ timer_create (clock_id, evp, timerid) if (__timer_init_failed) { - errno = ENOMEM; + __set_errno (ENOMEM); return -1; } @@ -63,7 +63,7 @@ timer_create (clock_id, evp, timerid) newtimer = __timer_alloc (); if (__builtin_expect (newtimer == NULL, 0)) { - errno = EAGAIN; + __set_errno (EAGAIN); goto unlock_bail; } @@ -106,13 +106,13 @@ timer_create (clock_id, evp, timerid) break; #endif } - + if (! thread->exists) { if (__builtin_expect (__timer_thread_start (thread), 1) < 0) { - errno = EAGAIN; + __set_errno (EAGAIN); goto unlock_bail; } } @@ -138,7 +138,7 @@ timer_create (clock_id, evp, timerid) /* Out of luck; no threads are available. */ if (__builtin_expect (thread == NULL, 0)) { - errno = EAGAIN; + __set_errno (EAGAIN); goto unlock_bail; } @@ -146,13 +146,13 @@ timer_create (clock_id, evp, timerid) if (! thread->exists && __builtin_expect (! __timer_thread_start (thread), 0)) { - errno = EAGAIN; + __set_errno (EAGAIN); goto unlock_bail; } break; default: - errno = EINVAL; + __set_errno (EINVAL); goto unlock_bail; } diff --git a/linuxthreads/sysdeps/pthread/timer_delete.c b/linuxthreads/sysdeps/pthread/timer_delete.c index 4636bf707a..b7d59fe68d 100644 --- a/linuxthreads/sysdeps/pthread/timer_delete.c +++ b/linuxthreads/sysdeps/pthread/timer_delete.c @@ -36,9 +36,9 @@ timer_delete (timerid) pthread_mutex_lock (&__timer_mutex); timer = timer_id2ptr (timerid); - if (timer == NULL || !timer->inuse) + if (! timer_valid (timer)) /* Invalid timer ID or the timer is not in use. */ - errno = EINVAL; + __set_errno (EINVAL); else { if (timer->armed) @@ -50,16 +50,17 @@ timer_delete (timerid) the mutex is unlocked and timer_delete is aborted. */ pthread_cleanup_push (__timer_mutex_cancel_handler, &__timer_mutex); - /* If timer is currently being serviced, wait for it to finish. */ - while (thread->current_timer == timer) - pthread_cond_wait (&thread->cond, &__timer_mutex); + /* If timer is currently being serviced, wait for it to finish. */ + while (thread->current_timer == timer) + pthread_cond_wait (&thread->cond, &__timer_mutex); - pthread_cleanup_pop (0); + pthread_cleanup_pop (0); } /* Remove timer from whatever queue it may be on and deallocate it. */ + timer->inuse = TIMER_DELETED; list_unlink_ip (&timer->links); - __timer_dealloc (timer); + timer_delref (timer); retval = 0; } |