2007-05-18 02:55:10 +02:00
|
|
|
/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
|
|
|
|
2005-12-27 02:04:06 +01:00
|
|
|
#include <assert.h>
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
#include <errno.h>
|
2006-07-31 07:58:51 +02:00
|
|
|
#include <time.h>
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
#include "pthreadP.h"
|
|
|
|
#include <lowlevellock.h>
|
2006-07-31 07:58:51 +02:00
|
|
|
#include <not-cancel.h>
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutex_timedlock (mutex, abstime)
|
|
|
|
pthread_mutex_t *mutex;
|
|
|
|
const struct timespec *abstime;
|
|
|
|
{
|
2006-02-15 18:20:33 +01:00
|
|
|
int oldval;
|
2003-06-23 01:55:27 +02:00
|
|
|
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
/* We must not check ABSTIME here. If the thread does not block
|
|
|
|
abstime must not be checked for a valid value. */
|
|
|
|
|
2007-06-19 00:22:57 +02:00
|
|
|
switch (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex),
|
|
|
|
PTHREAD_MUTEX_TIMED_NP))
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
{
|
|
|
|
/* Recursive mutex. */
|
|
|
|
case PTHREAD_MUTEX_RECURSIVE_NP:
|
|
|
|
/* Check whether we already hold the mutex. */
|
2003-05-02 01:19:51 +02:00
|
|
|
if (mutex->__data.__owner == id)
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
{
|
|
|
|
/* Just bump the counter. */
|
|
|
|
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
|
|
|
/* Overflow of the counter. */
|
|
|
|
return EAGAIN;
|
|
|
|
|
|
|
|
++mutex->__data.__count;
|
|
|
|
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2005-12-27 02:04:06 +01:00
|
|
|
/* We have to get the mutex. */
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
result = lll_timedlock (mutex->__data.__lock, abstime,
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
PTHREAD_MUTEX_PSHARED (mutex));
|
2007-07-12 20:26:36 +02:00
|
|
|
|
2005-12-27 02:04:06 +01:00
|
|
|
if (result != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* Only locked once so far. */
|
|
|
|
mutex->__data.__count = 1;
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* Error checking mutex. */
|
|
|
|
case PTHREAD_MUTEX_ERRORCHECK_NP:
|
|
|
|
/* Check whether we already hold the mutex. */
|
2006-07-29 06:42:09 +02:00
|
|
|
if (__builtin_expect (mutex->__data.__owner == id, 0))
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
return EDEADLK;
|
|
|
|
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
case PTHREAD_MUTEX_TIMED_NP:
|
2004-03-24 07:36:06 +01:00
|
|
|
simple:
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
/* Normal mutex. */
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
result = lll_timedlock (mutex->__data.__lock, abstime,
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
PTHREAD_MUTEX_PSHARED (mutex));
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
break;
|
2004-03-24 07:36:06 +01:00
|
|
|
|
|
|
|
case PTHREAD_MUTEX_ADAPTIVE_NP:
|
|
|
|
if (! __is_smp)
|
|
|
|
goto simple;
|
|
|
|
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
if (lll_trylock (mutex->__data.__lock) != 0)
|
2004-03-24 07:36:06 +01:00
|
|
|
{
|
|
|
|
int cnt = 0;
|
|
|
|
int max_cnt = MIN (MAX_ADAPTIVE_COUNT,
|
|
|
|
mutex->__data.__spins * 2 + 10);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (cnt++ >= max_cnt)
|
|
|
|
{
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
result = lll_timedlock (mutex->__data.__lock, abstime,
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
PTHREAD_MUTEX_PSHARED (mutex));
|
2004-03-24 07:36:06 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BUSY_WAIT_NOP
|
|
|
|
BUSY_WAIT_NOP;
|
|
|
|
#endif
|
|
|
|
}
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
while (lll_trylock (mutex->__data.__lock) != 0);
|
2004-03-24 07:36:06 +01:00
|
|
|
|
|
|
|
mutex->__data.__spins += (cnt - mutex->__data.__spins) / 8;
|
|
|
|
}
|
|
|
|
break;
|
2005-12-24 00:49:41 +01:00
|
|
|
|
2006-03-28 06:25:17 +02:00
|
|
|
case PTHREAD_MUTEX_ROBUST_RECURSIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP:
|
|
|
|
case PTHREAD_MUTEX_ROBUST_NORMAL_NP:
|
|
|
|
case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
|
|
|
|
&mutex->__data.__list.__next);
|
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
oldval = mutex->__data.__lock;
|
|
|
|
do
|
2005-12-27 02:04:06 +01:00
|
|
|
{
|
2006-03-28 06:25:17 +02:00
|
|
|
again:
|
2006-02-15 18:20:33 +01:00
|
|
|
if ((oldval & FUTEX_OWNER_DIED) != 0)
|
|
|
|
{
|
|
|
|
/* The previous owner died. Try locking the mutex. */
|
2007-05-18 02:55:10 +02:00
|
|
|
int newval = id | (oldval & FUTEX_WAITERS);
|
|
|
|
|
|
|
|
newval
|
2006-03-28 06:25:17 +02:00
|
|
|
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
2007-05-18 02:55:10 +02:00
|
|
|
newval, oldval);
|
2006-03-28 06:25:17 +02:00
|
|
|
if (newval != oldval)
|
2006-02-15 18:20:33 +01:00
|
|
|
{
|
|
|
|
oldval = newval;
|
2006-03-28 06:25:17 +02:00
|
|
|
goto again;
|
2006-02-15 18:20:33 +01:00
|
|
|
}
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
/* We got the mutex. */
|
|
|
|
mutex->__data.__count = 1;
|
|
|
|
/* But it is inconsistent unless marked otherwise. */
|
|
|
|
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
ENQUEUE_MUTEX (mutex);
|
2006-03-28 06:25:17 +02:00
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-07-29 06:42:09 +02:00
|
|
|
/* Note that we deliberately exit here. If we fall
|
2006-02-15 18:20:33 +01:00
|
|
|
through to the end of the function __nusers would be
|
|
|
|
incremented which is not correct because the old
|
|
|
|
owner has to be discounted. */
|
|
|
|
return EOWNERDEAD;
|
|
|
|
}
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
/* Check whether we already hold the mutex. */
|
2006-03-28 06:25:17 +02:00
|
|
|
if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
|
2006-02-15 18:20:33 +01:00
|
|
|
{
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
int kind = PTHREAD_MUTEX_TYPE (mutex);
|
|
|
|
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
|
2006-03-28 06:25:17 +02:00
|
|
|
{
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
|
|
|
|
NULL);
|
|
|
|
return EDEADLK;
|
|
|
|
}
|
2005-12-27 02:04:06 +01:00
|
|
|
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
if (kind == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
|
2006-02-15 18:20:33 +01:00
|
|
|
{
|
2006-03-28 06:25:17 +02:00
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
|
|
|
|
NULL);
|
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
/* Just bump the counter. */
|
|
|
|
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
|
|
|
/* Overflow of the counter. */
|
|
|
|
return EAGAIN;
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
++mutex->__data.__count;
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2005-12-27 02:04:06 +01:00
|
|
|
|
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Use __asm __volatile (__lll_acq_instr ::: "memory") instead of
atomic_full_barrier.
2007-07-31 Jakub Jelinek <jakub@redhat.com>
* allocatestack.c (stack_cache_lock): Change type to int.
(get_cached_stack, allocate_stack, __deallocate_stack,
__make_stacks_executable, __find_thread_by_id, __nptl_setxid,
__pthread_init_static_tls, __wait_lookup_done): Add LLL_PRIVATE
as second argument to lll_lock and lll_unlock macros on
stack_cache_lock.
* pthread_create.c (__find_in_stack_list): Likewise.
(start_thread): Similarly with pd->lock. Use lll_robust_dead
macro instead of lll_robust_mutex_dead, pass LLL_SHARED to it
as second argument.
* descr.h (struct pthread): Change lock and setxid_futex field
type to int.
* old_pthread_cond_broadcast.c (__pthread_cond_broadcast_2_0): Use
LLL_LOCK_INITIALIZER instead of LLL_MUTEX_LOCK_INITIALIZER.
* old_pthread_cond_signal.c (__pthread_cond_signal_2_0): Likewise.
* old_pthread_cond_timedwait.c (__pthread_cond_timedwait_2_0):
Likewise.
* old_pthread_cond_wait.c (__pthread_cond_wait_2_0): Likewise.
* pthread_cond_init.c (__pthread_cond_init): Likewise.
* pthreadP.h (__attr_list_lock): Change type to int.
* pthread_attr_init.c (__attr_list_lock): Likewise.
* pthread_barrier_destroy.c (pthread_barrier_destroy): Pass
ibarrier->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_{,un}lock.
* pthread_barrier_wait.c (pthread_barrier_wait): Likewise and
also for lll_futex_{wake,wait}.
* pthread_barrier_init.c (pthread_barrier_init): Make iattr
a pointer to const.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Pass
LLL_SHARED as second argument to lll_{,un}lock.
* pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
* pthread_cond_signal.c (__pthread_cond_singal): Likewise.
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait):
Likewise.
* pthread_getattr_np.c (pthread_getattr_np): Add LLL_PRIVATE
as second argument to lll_{,un}lock macros on pd->lock.
* pthread_getschedparam.c (__pthread_getschedparam): Likewise.
* pthread_setschedparam.c (__pthread_setschedparam): Likewise.
* pthread_setschedprio.c (pthread_setschedprio): Likewise.
* tpp.c (__pthread_tpp_change_priority, __pthread_current_priority):
Likewise.
* sysdeps/pthread/createthread.c (do_clone, create_thread):
Likewise.
* pthread_once.c (once_lock): Change type to int.
(__pthread_once): Pass LLL_PRIVATE as second argument to
lll_{,un}lock macros on once_lock.
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Use
lll_{,un}lock macros instead of lll_mutex_{,un}lock, pass
rwlock->__data.__shared as second argument to them and similarly
for lll_futex_w*.
* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Likewise.
* pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
* sem_close.c (sem_close): Pass LLL_PRIVATE as second argument
to lll_{,un}lock macros on __sem_mappings_lock.
* sem_open.c (check_add_mapping): Likewise.
(__sem_mappings_lock): Change type to int.
* semaphoreP.h (__sem_mappings_lock): Likewise.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK): Use lll_{,try,robust_}lock macros
instead of lll_*mutex_*, pass LLL_SHARED as last
argument.
(__pthread_mutex_lock): Use lll_unlock instead of lll_mutex_unlock,
pass LLL_SHARED as last argument.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK,
LLL_MUTEX_TRYLOCK, LLL_ROBUST_MUTEX_LOCK): Use
lll_{cond_,cond_try,robust_cond}lock macros instead of lll_*mutex_*,
pass LLL_SHARED as last argument.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
lll_{timed,try,robust_timed,un}lock instead of lll_*mutex*, pass
LLL_SHARED as last argument.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Similarly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
Similarly.
* sysdeps/pthread/bits/libc-lock.h (__libc_lock_lock,
__libc_lock_lock_recursive, __libc_lock_unlock,
__libc_lock_unlock_recursive): Pass LLL_PRIVATE as second
argument to lll_{,un}lock.
* sysdeps/pthread/bits/stdio-lock.h (_IO_lock_lock,
_IO_lock_unlock): Likewise.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Don't use
compound literal.
* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
Pass LLL_PRIVATE as second argument to lll_{,un}lock macros on
__fork_lock.
* sysdeps/unix/sysv/linux/register-atfork.c (__register_atfork,
free_mem): Likewise.
(__fork_lock): Change type to int.
* sysdeps/unix/sysv/linux/fork.h (__fork_lock): Likewise.
* sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Pass
isem->private ^ FUTEX_PRIVATE_FLAG as second argument to
lll_futex_wake.
* sysdeps/unix/sysv/linux/sem_timedwait.c (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sem_wait.c (__new_sem_wait): Likewise.
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_lock_wait_private):
New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument and
pass it through to lll_futex_*wait, only compile in when
IS_IN_libpthread.
* sysdeps/unix/sysv/linux/lowlevelrobustlock.c
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Add private
argument and pass it through to lll_futex_*wait.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Renamed all
lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp.
lll_robust_*. Renamed all __lll_mutex_* resp. __lll_robust_mutex_*
inline functions to __lll_* resp. __lll_robust_*.
(LLL_MUTEX_LOCK_INITIALIZER): Remove.
(lll_mutex_dead): Add private argument.
(__lll_lock_wait_private): New prototype.
(__lll_lock_wait, __lll_robust_lock_wait, __lll_lock_timedwait,
__lll_robust_lock_timedwait): Add private argument to prototypes.
(__lll_lock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_lock_wait_private, otherwise pass private to
__lll_lock_wait.
(__lll_robust_lock, __lll_cond_lock, __lll_timedlock,
__lll_robust_timedlock): Add private argument, pass it to
__lll_*wait functions.
(__lll_unlock): Add private argument, if it is constant LLL_PRIVATE,
call __lll_unlock_wake_private, otherwise pass private to
__lll_unlock_wake.
(__lll_robust_unlock): Add private argument, pass it to
__lll_robust_unlock_wake.
(lll_lock, lll_robust_lock, lll_cond_lock, lll_timedlock,
lll_robust_timedlock, lll_unlock, lll_robust_unlock): Add private
argument, pass it through to __lll_* inline function.
(__lll_mutex_unlock_force, lll_mutex_unlock_force): Remove.
(lll_lock_t): Remove.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Allow including
the header from assembler. Renamed all lll_mutex_* resp.
lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
(LOCK, FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define.
(LLL_MUTEX_LOCK_INITIALIZER, LLL_MUTEX_LOCK_INITIALIZER_LOCKED,
LLL_MUTEX_LOCK_INITIALIZER_WAITERS): Remove.
(__lll_mutex_lock_wait, __lll_mutex_timedlock_wait,
__lll_mutex_unlock_wake, __lll_lock_wait, __lll_unlock_wake):
Remove prototype.
(__lll_trylock_asm, __lll_lock_asm_start, __lll_unlock_asm): Define.
(lll_robust_trylock, lll_cond_trylock): Use LLL_LOCK_INITIALIZER*
rather than LLL_MUTEX_LOCK_INITIALIZER* macros.
(lll_trylock): Likewise, use __lll_trylock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand.
(lll_lock): Add private argument, use __lll_lock_asm_start, pass
MULTIPLE_THREADS_OFFSET as last asm operand, call
__lll_lock_wait_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_lock_wait.
(lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
lll_timedlock, lll_robust_timedlock): Add private argument, pass
private as another argument to __lll_*lock_wait call.
(lll_unlock): Add private argument, use __lll_unlock_asm, pass
MULTIPLE_THREADS_OFFSET as another asm operand, call
__lll_unlock_wake_private if private is constant LLL_PRIVATE,
otherwise pass private as another argument to __lll_unlock_wake.
(lll_robust_unlock): Add private argument, pass private as another
argument to __lll_unlock_wake.
(lll_robust_dead): Add private argument, use __lll_private_flag
macro.
(lll_islocked): Use LLL_LOCK_INITIALIZER instead of
LLL_MUTEX_LOCK_INITIALIZER.
(lll_lock_t): Remove.
(LLL_LOCK_INITIALIZER_WAITERS): Define.
(__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
__lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
lll_cond_wake, lll_cond_broadcast): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. Take futex addr from %edx instead of
%ecx, %ecx is now private argument. Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. Use __NR_gettimeofday. %esi
contains private argument. Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %ecx contains private argument.
Don't compile in for libc.so.
(__lll_timedwait_tid): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't
define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. Futex addr is now in %edx
argument, %ecx argument contains private. Use LOAD_FUTEX_WAIT
macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. Use __NR_gettimeofday.
%esi argument contains private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%ebx) ^ LLL_SHARED as private argument in %ecx to
__lll_lock_wait and __lll_unlock_wake, pass MUTEX(%ebx) address
to __lll_lock_wait in %edx.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*, pass
cond_lock address in %edx rather than %ecx to __lll_lock_wait,
pass LLL_SHARED in %ecx to both __lll_lock_wait and
__lll_unlock_wake. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_w_cleanup): Rename __lll_mutex_*
to __lll_*, pass cond_lock address in %edx rather than %ecx to
__lll_lock_wait, pass LLL_SHARED in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebp) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebp) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register. Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%edi) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%edi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*, pass
MUTEX(%ebx) address in %edx rather than %ecx to
__lll_lock_wait, pass PSHARED(%ebx) in %ecx to both __lll_lock_wait
and __lll_unlock_wake. Move return value from %ecx to %edx
register.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, SYS_gettimeofday, FUTEX_WAIT): Don't define.
(sem_timedwait): Use __NR_gettimeofday.
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/powerpc/sem_post.c: Wake only when there
are waiters.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Revert
2007-05-2{3,9} changes.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_PRIVATE_FUTEX_WAIT): Define.
(LOAD_FUTEX_WAIT): Rewritten.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_lock_wait_private, __lll_unlock_wake_private): New functions.
(__lll_mutex_lock_wait): Rename to ...
(__lll_lock_wait): ... this. %esi is now private argument.
Don't compile in for libc.so.
(__lll_mutex_timedlock_wait): Rename to ...
(__lll_timedlock_wait): ... this. %esi contains private argument.
Don't compile in for libc.so.
(__lll_mutex_unlock_wake): Rename to ...
(__lll_unlock_wake): ... this. %esi contains private argument.
Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Include
kernel-features.h and lowlevellock.h.
(LOAD_FUTEX_WAIT): Define.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Don't define.
(__lll_robust_mutex_lock_wait): Rename to ...
(__lll_robust_lock_wait): ... this. %esi argument contains private.
Use LOAD_FUTEX_WAIT macro.
(__lll_robust_mutex_timedlock_wait): Rename to ...
(__lll_robust_timedlock_wait): ... this. %esi argument contains
private, use LOAD_FUTEX_WAIT macro.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Include
lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(pthread_barrier_wait): Rename __lll_mutex_* to __lll_*, pass
PRIVATE(%rdi) ^ LLL_SHARED as private argument in %esi to
__lll_lock_wait and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
FUTEX_CMP_REQUEUE, EINVAL, LOCK): Don't define.
(__pthread_cond_broadcast): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:
Include lowlevellock.h and pthread-errnos.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, EINVAL, LOCK): Don't define.
(__pthread_cond_signal): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_timedwait): Rename __lll_mutex_* to __lll_*,
pass LLL_SHARED in %esi to both __lll_lock_wait and
__lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, LOCK): Don't define.
(__pthread_cond_wait, __condvar_cleanup): Rename __lll_mutex_*
to __lll_*, pass LLL_SHARED in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_rdlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_unlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %esi to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:
Include lowlevellock.h.
(SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG, LOCK):
Don't define.
(__pthread_rwlock_wrlock): Rename __lll_mutex_* to __lll_*,
pass PSHARED(%rdi) in %ecx to both __lll_lock_wait
and __lll_unlock_wake.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Don't
define.
* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Include lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAKE): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Include
lowlevellock.h.
(LOCK): Don't define.
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Include
lowlevellock.h.
(LOCK, SYS_futex, FUTEX_WAIT): Don't define.
* sysdeps/unix/sysv/linux/sparc/internaltypes.h: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c: New file.
* sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
(__lll_lock_wait_private): New function.
(__lll_lock_wait, __lll_timedlock_wait): Add private argument, pass
it to lll_futex_*wait. Don't compile in for libc.so.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
(struct sparc_pthread_barrier): Remove.
(pthread_barrier_wait): Use union sparc_pthread_barrier instead of
struct sparc_pthread_barrier. Pass
ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE to lll_{,un}lock
and lll_futex_wait macros.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
Include sparc pthread_barrier_wait.c instead of generic one.
2007-08-01 06:47:26 +02:00
|
|
|
result = lll_robust_timedlock (mutex->__data.__lock, abstime, id,
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
if (__builtin_expect (mutex->__data.__owner
|
|
|
|
== PTHREAD_MUTEX_NOTRECOVERABLE, 0))
|
|
|
|
{
|
|
|
|
/* This mutex is now not recoverable. */
|
|
|
|
mutex->__data.__count = 0;
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
lll_unlock (mutex->__data.__lock,
|
|
|
|
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
|
2006-03-28 06:25:17 +02:00
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
2006-02-15 18:20:33 +01:00
|
|
|
return ENOTRECOVERABLE;
|
|
|
|
}
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
if (result == ETIMEDOUT || result == EINVAL)
|
|
|
|
goto out;
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
oldval = result;
|
2005-12-27 02:04:06 +01:00
|
|
|
}
|
2006-02-15 18:20:33 +01:00
|
|
|
while ((oldval & FUTEX_OWNER_DIED) != 0);
|
2005-12-27 02:04:06 +01:00
|
|
|
|
2006-02-15 18:20:33 +01:00
|
|
|
mutex->__data.__count = 1;
|
2005-12-27 02:04:06 +01:00
|
|
|
ENQUEUE_MUTEX (mutex);
|
2006-03-28 06:25:17 +02:00
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
2005-12-27 02:04:06 +01:00
|
|
|
break;
|
|
|
|
|
2006-07-29 06:42:09 +02:00
|
|
|
case PTHREAD_MUTEX_PI_RECURSIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ERRORCHECK_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_NORMAL_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ADAPTIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ROBUST_RECURSIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ROBUST_ERRORCHECK_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP:
|
|
|
|
case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP:
|
|
|
|
{
|
|
|
|
int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP;
|
|
|
|
int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP;
|
|
|
|
|
|
|
|
if (robust)
|
|
|
|
/* Note: robust PI futexes are signaled by setting bit 0. */
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
|
|
|
|
(void *) (((uintptr_t) &mutex->__data.__list.__next)
|
|
|
|
| 1));
|
|
|
|
|
|
|
|
oldval = mutex->__data.__lock;
|
|
|
|
|
|
|
|
/* Check whether we already hold the mutex. */
|
|
|
|
if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
|
|
|
|
{
|
|
|
|
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
|
|
|
|
{
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
|
|
|
return EDEADLK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
|
|
|
|
{
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
|
|
|
|
|
|
|
/* Just bump the counter. */
|
|
|
|
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
|
|
|
/* Overflow of the counter. */
|
|
|
|
return EAGAIN;
|
|
|
|
|
|
|
|
++mutex->__data.__count;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
oldval = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
|
|
|
id, 0);
|
|
|
|
|
|
|
|
if (oldval != 0)
|
|
|
|
{
|
|
|
|
/* The mutex is locked. The kernel will now take care of
|
|
|
|
everything. The timeout value must be a relative value.
|
|
|
|
Convert it. */
|
|
|
|
INTERNAL_SYSCALL_DECL (__err);
|
|
|
|
|
|
|
|
int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
|
|
|
|
FUTEX_LOCK_PI, 1, abstime);
|
|
|
|
if (INTERNAL_SYSCALL_ERROR_P (e, __err))
|
|
|
|
{
|
|
|
|
if (INTERNAL_SYSCALL_ERRNO (e, __err) == ETIMEDOUT)
|
|
|
|
return ETIMEDOUT;
|
|
|
|
|
|
|
|
if (INTERNAL_SYSCALL_ERRNO (e, __err) == ESRCH
|
|
|
|
|| INTERNAL_SYSCALL_ERRNO (e, __err) == EDEADLK)
|
|
|
|
{
|
|
|
|
assert (INTERNAL_SYSCALL_ERRNO (e, __err) != EDEADLK
|
|
|
|
|| (kind != PTHREAD_MUTEX_ERRORCHECK_NP
|
|
|
|
&& kind != PTHREAD_MUTEX_RECURSIVE_NP));
|
|
|
|
/* ESRCH can happen only for non-robust PI mutexes where
|
|
|
|
the owner of the lock died. */
|
|
|
|
assert (INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH
|
|
|
|
|| !robust);
|
|
|
|
|
|
|
|
/* Delay the thread until the timeout is reached.
|
|
|
|
Then return ETIMEDOUT. */
|
|
|
|
struct timespec reltime;
|
|
|
|
struct timespec now;
|
|
|
|
|
|
|
|
INTERNAL_SYSCALL (clock_gettime, __err, 2, CLOCK_REALTIME,
|
|
|
|
&now);
|
|
|
|
reltime.tv_sec = abstime->tv_sec - now.tv_sec;
|
|
|
|
reltime.tv_nsec = abstime->tv_nsec - now.tv_nsec;
|
|
|
|
if (reltime.tv_nsec < 0)
|
|
|
|
{
|
|
|
|
reltime.tv_nsec += 1000000000;
|
|
|
|
--reltime.tv_sec;
|
|
|
|
}
|
|
|
|
if (reltime.tv_sec >= 0)
|
2006-07-31 07:58:51 +02:00
|
|
|
while (nanosleep_not_cancel (&reltime, &reltime) != 0)
|
2006-07-29 06:42:09 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
return ETIMEDOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return INTERNAL_SYSCALL_ERRNO (e, __err);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldval = mutex->__data.__lock;
|
|
|
|
|
|
|
|
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
|
|
|
|
{
|
|
|
|
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
|
|
|
|
|
|
|
/* We got the mutex. */
|
|
|
|
mutex->__data.__count = 1;
|
|
|
|
/* But it is inconsistent unless marked otherwise. */
|
|
|
|
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
|
|
|
|
|
|
|
|
ENQUEUE_MUTEX_PI (mutex);
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
|
|
|
|
|
|
|
/* Note that we deliberately exit here. If we fall
|
|
|
|
through to the end of the function __nusers would be
|
|
|
|
incremented which is not correct because the old owner
|
|
|
|
has to be discounted. */
|
|
|
|
return EOWNERDEAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (robust
|
|
|
|
&& __builtin_expect (mutex->__data.__owner
|
|
|
|
== PTHREAD_MUTEX_NOTRECOVERABLE, 0))
|
|
|
|
{
|
|
|
|
/* This mutex is now not recoverable. */
|
|
|
|
mutex->__data.__count = 0;
|
|
|
|
|
|
|
|
INTERNAL_SYSCALL_DECL (__err);
|
|
|
|
INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
|
|
|
|
FUTEX_UNLOCK_PI, 0, 0);
|
|
|
|
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
|
|
|
return ENOTRECOVERABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex->__data.__count = 1;
|
|
|
|
if (robust)
|
|
|
|
{
|
|
|
|
ENQUEUE_MUTEX_PI (mutex);
|
|
|
|
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-08-15 01:11:18 +02:00
|
|
|
case PTHREAD_MUTEX_PP_RECURSIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_PP_ERRORCHECK_NP:
|
|
|
|
case PTHREAD_MUTEX_PP_NORMAL_NP:
|
|
|
|
case PTHREAD_MUTEX_PP_ADAPTIVE_NP:
|
|
|
|
{
|
|
|
|
int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP;
|
|
|
|
|
|
|
|
oldval = mutex->__data.__lock;
|
|
|
|
|
|
|
|
/* Check whether we already hold the mutex. */
|
|
|
|
if (mutex->__data.__owner == id)
|
|
|
|
{
|
|
|
|
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
|
|
|
|
return EDEADLK;
|
|
|
|
|
|
|
|
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
|
|
|
|
{
|
|
|
|
/* Just bump the counter. */
|
|
|
|
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
|
|
|
/* Overflow of the counter. */
|
|
|
|
return EAGAIN;
|
|
|
|
|
|
|
|
++mutex->__data.__count;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int oldprio = -1, ceilval;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int ceiling = (oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK)
|
|
|
|
>> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
|
|
|
|
|
|
|
|
if (__pthread_current_priority () > ceiling)
|
|
|
|
{
|
|
|
|
result = EINVAL;
|
|
|
|
failpp:
|
|
|
|
if (oldprio != -1)
|
|
|
|
__pthread_tpp_change_priority (oldprio, -1);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
result = __pthread_tpp_change_priority (oldprio, ceiling);
|
|
|
|
if (result)
|
|
|
|
return result;
|
|
|
|
|
|
|
|
ceilval = ceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
|
|
|
|
oldprio = ceiling;
|
|
|
|
|
|
|
|
oldval
|
|
|
|
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
|
|
|
ceilval | 1, ceilval);
|
|
|
|
|
|
|
|
if (oldval == ceilval)
|
|
|
|
break;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
oldval
|
|
|
|
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
|
|
|
ceilval | 2,
|
|
|
|
ceilval | 1);
|
|
|
|
|
|
|
|
if ((oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK) != ceilval)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (oldval != ceilval)
|
|
|
|
{
|
|
|
|
/* Reject invalid timeouts. */
|
|
|
|
if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
|
|
|
|
{
|
|
|
|
result = EINVAL;
|
|
|
|
goto failpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct timeval tv;
|
|
|
|
struct timespec rt;
|
|
|
|
|
|
|
|
/* Get the current time. */
|
|
|
|
(void) __gettimeofday (&tv, NULL);
|
|
|
|
|
|
|
|
/* Compute relative timeout. */
|
|
|
|
rt.tv_sec = abstime->tv_sec - tv.tv_sec;
|
|
|
|
rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
|
|
|
|
if (rt.tv_nsec < 0)
|
|
|
|
{
|
|
|
|
rt.tv_nsec += 1000000000;
|
|
|
|
--rt.tv_sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Already timed out? */
|
|
|
|
if (rt.tv_sec < 0)
|
|
|
|
{
|
|
|
|
result = ETIMEDOUT;
|
|
|
|
goto failpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
lll_futex_timed_wait (&mutex->__data.__lock,
|
2007-06-08 04:50:59 +02:00
|
|
|
ceilval | 2, &rt,
|
* pthreadP.h (PTHREAD_ROBUST_MUTEX_PSHARED): Define.
* pthread_mutex_lock.c: Use it instead of PTHREAD_MUTEX_PSHARED when
dealing with robust mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
2007-08-06 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (PTHREAD_MUTEX_PSHARED_BIT): Define.
(PTHREAD_MUTEX_TYPE): Mask __kind with 127.
(PTHREAD_MUTEX_PSHARED): Define.
* pthread_mutex_init.c (__pthread_mutex_init): Set
PTHREAD_MUTEX_PSHARED_BIT for pshared or robust
mutexes.
* pthread_mutex_lock.c (LLL_MUTEX_LOCK): Take mutex as argument
instead of its __data.__lock field, pass PTHREAD_MUTEX_PSHARED
as second argument to lll_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument
instead of its __data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_lock.
(__pthread_mutex_lock): Update LLL_MUTEX_LOCK, LLL_MUTEX_TRYLOCK,
LLL_ROBUST_MUTEX_LOCK users, use PTHREAD_MUTEX_TYPE (mutex)
instead of mutex->__data.__kind directly, pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock and lll_futex_wait.
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly, pass PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock.
(pthread_mutex_timedlock): Pass PTHREAD_MUTEX_PSHARED (mutex)
to lll_timedlock, lll_robust_timedlock, lll_unlock and
lll_futex_timed_wait. Use PTHREAD_MUTEX_TYPE (mutex) instead
of mutex->__data.__kind directly.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_timedlock,
lll_robust_timedlock, lll_unlock and lll_futex_timed_wait. Use
PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind directly.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_unlock, lll_robust_unlock
and lll_futex_wake.
* pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Pass
PTHREAD_MUTEX_PSHARED (mutex) to lll_futex_wait and lll_futex_wake.
Use PTHREAD_MUTEX_TYPE (mutex) instead of mutex->__data.__kind
directly.
* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c (LLL_MUTEX_LOCK):
Take mutex as argument instead of its __data.__lock field, pass
PTHREAD_MUTEX_PSHARED as second argument to lll_cond_lock.
(LLL_MUTEX_TRYLOCK): Take mutex as argument instead of its
__data.__lock field.
(LLL_ROBUST_MUTEX_LOCK): Take mutex as argument instead of its
__data.__lock field, pass PTHREAD_MUTEX_PSHARED as second argument
to lll_robust_cond_lock.
* pthread_cond_broadcast.c (__pthread_cond_broadcast): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_requeue and
lll_futex_wake. Don't use lll_futex_requeue if dependent mutex
has PTHREAD_MUTEX_PSHARED_BIT bit set in its __data.__kind.
* pthread_cond_destroy.c (__pthread_cond_destroy): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake and
lll_futex_wait.
* pthread_cond_signal.c (__pthread_cond_signal): Add pshared
variable, pass it to lll_lock, lll_unlock, lll_futex_wake_unlock and
lll_futex_wake.
* pthread_cond_timedwait.c (__pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock,
lll_futex_timedwait and lll_futex_wake.
* pthread_cond_wait.c (__condvar_cleanup, __pthread_cond_wait): Add
pshared variable, pass it to lll_lock, lll_unlock, lll_futex_wait
and lll_futex_wake.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Add private argument, use __lll_private_flag
macro.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_futex_requeue):
Likewise.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_futex_requeue,
lll_futex_wake_unlock): Likewise.
(lll_futex_wake): Fix a typo.
* sysdeps/unix/sysv/linux/pthread-pi-defines.sym (PS_BIT): Add.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:
(__condvar_cleanup, __pthread_cond_wait): Likewise.
2007-08-11 20:50:51 +02:00
|
|
|
PTHREAD_MUTEX_PSHARED (mutex));
|
2006-08-15 01:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
|
|
|
ceilval | 2, ceilval)
|
|
|
|
!= ceilval);
|
|
|
|
}
|
|
|
|
while ((oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK) != ceilval);
|
|
|
|
|
|
|
|
assert (mutex->__data.__owner == 0);
|
|
|
|
mutex->__data.__count = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-12-24 00:49:41 +01:00
|
|
|
default:
|
|
|
|
/* Correct code cannot set any other type. */
|
|
|
|
return EINVAL;
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == 0)
|
2003-06-23 01:55:27 +02:00
|
|
|
{
|
|
|
|
/* Record the ownership. */
|
|
|
|
mutex->__data.__owner = id;
|
|
|
|
++mutex->__data.__nusers;
|
|
|
|
}
|
Initial revision
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (queue_stack): Don't remove stack from list here.
Do it in the caller. Correct condition to prematurely terminate
loop to free stacks.
(__deallocate_stack): Remove stack from list here.
2002-11-26 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-stack1.
* tst-stack1.c: New file.
* allocatestack.c (allocate_stack): Initialize the TCB on a user
provided stack.
* pthread_attr_getstack.c: Return bottom of the thread area.
2002-11-25 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pt-allocrtsig and
pthread_kill_other_threads.
* pt-allocrtsig.c: New file.
* pthread_kill_other_threads.c: New file.
* sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
all three functions.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
allocrtsig.
* sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
__libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
and __libc_allocate_rtsig_private.
* Versions (libpthread): Export pthread_kill_other_threads_np,
__libc_current_sigrtmin, and __libc_current_sigrtmax.
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (allocate_stack): stackaddr in attribute points to
the end of the stack. Adjust computations.
When mprotect call fails dequeue stack and free it.
* pthread_attr_setstack.c: Store top of the stack in stackaddr
attribute.
* pthread_getattr_np.c: Likewise.
* descr.h (IS_DETACHED): Add some more parenthesis to prevent
surprises.
2002-11-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-11-22 Ulrich Drepper <drepper@redhat.com>
* pthread_getspecific.c: Optimize access to first 2nd-level array.
* pthread_setspecific.c: Likewise.
2002-11-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
definitions. Get them from the official place.
* sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
* sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
Use new CLONE_ flags in clone() calls.
* sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
* sysdeps/unix/sysv/linux/i386/fork.c: New file.
* Versions: Add pthread_* functions for libc.
* forward.c: New file.
* sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
errno-loc.
* herrno.c: New file.
* res.c: New file.
* Makefile (libpthread-routines): Remove sem_post, sem_wait,
sem_trywait, and sem_timedwait. Add herrno and res.
* sem_init.c: Don't initialize lock and waiters members.
* sem_open.c: Likewise.
* sem_post.c: Removed.
* sem_wait.c: Removed.
* sem_trywait.c: Removed.
* sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
Includes full implementations of sem_post, sem_wait, sem_trywait,
and sem_timedwait.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
for new implementation.
* sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
and waiters fields.
* tst-sem3.c: Improve error message.
* tst-signal3.c: Likewise.
* init.c (__pthread_initialize_minimal): Use set_tid_address syscall
to tell the kernel about the termination futex and to initialize tid
member. Don't initialize main_thread.
* descr.h (struct pthread): Remove main_thread member.
* cancelllation.c (__do_cancel): Remove code handling main thread.
The main thread is not special anymore.
* allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add
size of the stacks to stack_cache_actsize.
* pt-readv.c: Add missing "defined".
* pt-sigwait.c: Likewise.
* pt-writev.c: Likewise.
2002-11-09 Ulrich Drepper <drepper@redhat.com>
* Versions: Export __connect from libpthread.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* Makefile (libpthread-routines): Add pt-raise.
* sysdeps/unix/sysv/linux/raise.c: New file.
* sysdeps/unix/sysv/linux/pt-raise.c: New file.
* sysdeps/generic/pt-raise.c: New file.
* pthread_cond_init.c: Initialize all data elements of the condvar
structure. Patch by Luca Barbieri <ldb@ldb.ods.org>.
* pthread_attr_init.c: Actually implement 2.0 compatibility version.
* pthread_create.c: Likewise.
* Makefile (tests): Add tst-key1, tst-key2, tst-key3.
* tst-key1.c: New file.
* tst-key2.c: New file.
* tst-key3.c: New file.
* Versions: Export pthread_detach for version GLIBC_2.0.
Reported by Saurabh Desai <sdesai@austin.ibm.com>.
2002-11-08 Ulrich Drepper <drepper@redhat.com>
* pthread_key_create.c: Terminate search after an unused key was found.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
Patch by Luca Barbieri <ldb@ldb.ods.org>.
2002-10-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
dynamic lookup for errno in PIC.
* allocatestack.c (get_cached_stack): Rearrange code slightly to
release the stack lock as soon as possible.
Call _dl_allocate_tls_init for TCB from the cache to re-initialize
the static TLS block.
(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
* cancellation.c: Renamed from cancelation.c.
* Makefile: Adjust accordingly.
* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
* cleanup_defer.c: Use CANCELLATION_P.
* pthread_testcancel.c: Likewise.
* descr.h: Fix spelling in comments.
* init.c: Likewise.
* pthread_getattr_np.c: Likewise.
* pthread_getschedparam.c: Likewise.
* pthread_setschedparam.c: Likewise.
* Versions: Likewise.
* pt-pselect.c: New file.
* Makefile (libpthread-routines): Add pt-pselect.
* Versions: Add pselect.
* tst-cancel4.c: New file.
* Makefile (tests): Add tst-cancel4.
2002-10-09 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_lock.c: Always record lock ownership.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pt-readv.c: New file.
* pt-writev.c: New file.
* pt-creat.c: New file.
* pt-msgrcv.c: New file.
* pt-msgsnd.c: New file.
* pt-poll.c: New file.
* pt-select.c: New file.
* pt-sigpause.c: New file.
* pt-sigsuspend.c: New file.
* pt-sigwait.c: New file.
* pt-sigwaitinfo.c: New file.
* pt-waitid.c: New file.
* Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
pt-sigwait, pt-sigwaitinfo, and pt-waitid.
* Versions: Add all the new functions.
* tst-exit1.c: New file.
* Makefile (tests): Add tst-exit1.
* sem_timedwait.c: Minor optimization for more optimal fastpath.
2002-10-08 Ulrich Drepper <drepper@redhat.com>
* pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
* pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
call. pthread_join is an official cancellation point.
* pthread_timedjoin.c: Likewise.
* pthread_cond_wait.c: Revert order in which internal lock are dropped
and the condvar's mutex are retrieved.
* pthread_cond_timedwait.c: Likewise.
Reported by dice@saros.East.Sun.COM.
2002-10-07 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Cut out all type definitions and move them...
* sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file.
* pthreadP.h: Include <internaltypes.h>.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
performance tweaks.
* sem_trywait.c: Shuffle #includes around to get right order.
* sem_timedwait.c: Likewise.
* sem_post.c: Likewise.
* sem_wait.c: Likewise.
* nptl 0.3 released.
* Makefile (tests): Add tst-signal3.
* tst-signal3.c: New file.
2002-10-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
the asms modify the sem object.
(__lll_sem_timedwait): Now takes struct sem* as first parameter.
* sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
the actual members.
* pthreadP.h (struct sem): New type. Actual semaphore type.
* semaphoreP.h: Include pthreadP.h.
* sem_getvalue.c: Adjust to sem_t change.
* sem_init.c: Likewise.
* sem_open.c: Likewise.
* sem_post.c: Likewise.
* sem_timedwait.c: Likewise.
* sem_trywait.c: Likewise.
* sem_wait.c: Likewise.
2002-10-04 Ulrich Drepper <drepper@redhat.com>
* Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
* tst-basic2.c: New file.
* tst-exec1.c: New file.
* tst-exec2.c: New file.
* tst-exec3.c: New file.
* tst-fork1.c: Remove extra */.
* nptl 0.2 released. The API for IA-32 is complete.
2002-11-26 23:50:54 +01:00
|
|
|
|
|
|
|
out:
|
|
|
|
return result;
|
|
|
|
}
|