Age | Commit message (Collapse) | Author |
|
* pthread/pt-alloc.c (__pthread_alloc): Use __pthread_rwlock_wrlock and
__pthread_rwlock_unlock instead of pthread_rwlock_wrlock and
pthread_rwlock_unlock.
* pthread/pt-create.c (__pthread_create_internal): Use__pthread_rwlock_rdlock and
__pthread_rwlock_unlock instead of pthread_rwlock_rdlock and
pthread_rwlock_unlock.
* pthread/pt-dealloc.c (__pthread_dealloc): Use
__pthread_cond_broadcast, __pthread_mutex_lock, and
__pthread_mutex_unlock instead of pthread_cond_broadcast,
pthread_mutex_lock, and pthread_mutex_unlock
* pthread/pt-exit.c (__pthread_exit): Use __pthread_setcancelstate and
__pthread_cond_broadcast instead of pthread_setcancelstate and
pthread_cond_broadcast.
* pthread/pt-internal.h (__pthread_getid, __pthread_setid): Use
__pthread_rwlock_rdlock, __pthread_rwlock_wrlock, and
__pthread_rwlock_unlock instead of pthread_rwlock_rdlock,
pthread_rwlock_wrlock, and pthread_rwlock_unlock
* pthread/pt-join.c (pthread_join): Use __pthread_cond_wait instead of
pthread_cond_wait.
* sysdeps/hurd/pt-key-delete.c (pthread_key_delete): Use
__pthread_rwlock_rdlock and __pthread_rwlock_unlock instead of
pthread_rwlock_rdlock and pthread_rwlock_unlock.
|
|
* pthread/pt-create.c (__pthread_create_internal): Call __getrlimit
instead of getrlimit.
|
|
This reverts commit c6fc9fbb8e0d2e0a8147197c31589cdc96497e07.
|
|
This reverts commit 44ae774bed1a75ea926590f1bc7c9f3328219832.
|
|
* sysdeps/generic/bits/barrier-attr.h (__pthread_barrierattr): Rename
`pshared' field to `__pshared'.
* sysdeps/generic/bits/barrier.h (__pthread_barrier): Rename `lock',
`'queue', `pending', `count', `attr', and `data' fields to `__lock',
`__queue', `__pending', `__count', `__attr', and `__data'.
* sysdeps/generic/bits/cancelation.h (__pthread_cancelation_handler): Rename
`handler', `arg', and `next' fields to `__handler', `__arg', and `__next'.
* sysdeps/generic/bits/condition-attr.h (__pthread_condattr): Rename
`pshared' and `clock' fields to `__pshared', and `__clock'.
* sysdeps/generic/bits/mutex-attr.h (__pthread_mutexattr): Rename
`prioceiling', `protocol', `pshared', and `mutex_type' fields to
`__prioceiling', `__protocol', `__pshared', and `__mutex_type'.
* sysdeps/generic/bits/mutex.h (__pthread_mutex): Rename `cthreadscompat1',
`attr', `data', `owner', and `locks' fields to `__cthreadscompat1',
`__attr', `__data', `__owner', and `__locks'.
* sysdeps/generic/bits/once.h (__pthread_once): Rename `run' and `lock'
fields to `__run' and `__lock'.
* sysdeps/generic/bits/rwlock-attr.h (__pthread_rwlockattr): Rename
`psharead' field to `__pshared'.
* sysdeps/generic/bits/rwlock.h (__pthread_rwlock): Rename `readers',
`readerqueue', and `writerqueue' fields to `__readers', `__readerqueue', and
`__writerqueue'.
* sysdeps/generic/bits/thread-attr.h (__pthread_contentionscope): Rename
`schedparam', `stackaddr', `stacksize', `guardsize', `detachstate',
`inheritsched', `contentionscope', and `schedpolicy' fields to
`__schedparam', `__stackaddr', `__stacksize', `__guardsize',
`__detachstate', `__inheritsched', `__contentionscope', and
`__schedpolicy''.
* sysdeps/generic/bits/cancelation.h: Update code accordingly.
* pthread/pt-create.c: Likewise.
* pthread/pt-exit.c: Likewise.
* pthread/pt-getattr.c: Likewise.
* sysdeps/generic/pt-attr-getdetachstate.c: Likewise.
* sysdeps/generic/pt-attr-getguardsize.c: Likewise.
* sysdeps/generic/pt-attr-getinheritsched.c: Likewise.
* sysdeps/generic/pt-attr-getschedparam.c: Likewise.
* sysdeps/generic/pt-attr-getschedpolicy.c: Likewise.
* sysdeps/generic/pt-attr-getscope.c: Likewise.
* sysdeps/generic/pt-attr-getstackaddr.c: Likewise.
* sysdeps/generic/pt-attr-getstacksize.c: Likewise.
* sysdeps/generic/pt-attr-setdetachstate.c: Likewise.
* sysdeps/generic/pt-attr-setguardsize.c: Likewise.
* sysdeps/generic/pt-attr-setinheritsched.c: Likewise.
* sysdeps/generic/pt-attr-setschedparam.c: Likewise.
* sysdeps/generic/pt-attr-setschedpolicy.c: Likewise.
* sysdeps/generic/pt-attr-setscope.c: Likewise.
* sysdeps/generic/pt-attr-setstackaddr.c: Likewise.
* sysdeps/generic/pt-attr-setstacksize.c: Likewise.
* sysdeps/generic/pt-attr.c: Likewise.
* sysdeps/generic/pt-barrier-init.c: Likewise.
* sysdeps/generic/pt-barrier-wait.c: Likewise.
* sysdeps/generic/pt-barrier.c: Likewise.
* sysdeps/generic/pt-barrierattr-getpshared.c: Likewise.
* sysdeps/generic/pt-barrierattr-setpshared.c: Likewise.
* sysdeps/generic/pt-cond-timedwait.c: Likewise.
* sysdeps/generic/pt-cond.c: Likewise.
* sysdeps/generic/pt-condattr-getclock.c: Likewise.
* sysdeps/generic/pt-condattr-getpshared.c: Likewise.
* sysdeps/generic/pt-condattr-setclock.c: Likewise.
* sysdeps/generic/pt-condattr-setpshared.c: Likewise.
* sysdeps/generic/pt-mutex-destroy.c: Likewise.
* sysdeps/generic/pt-mutex-init.c: Likewise.
* sysdeps/generic/pt-mutex-timedlock.c: Likewise.
* sysdeps/generic/pt-mutex-transfer-np.c: Likewise.
* sysdeps/generic/pt-mutex-trylock.c: Likewise.
* sysdeps/generic/pt-mutex-unlock.c: Likewise.
* sysdeps/generic/pt-mutexattr-getprotocol.c: Likewise.
* sysdeps/generic/pt-mutexattr-getpshared.c: Likewise.
* sysdeps/generic/pt-mutexattr-gettype.c: Likewise.
* sysdeps/generic/pt-mutexattr-setprotocol.c: Likewise.
* sysdeps/generic/pt-mutexattr-setpshared.c: Likewise.
* sysdeps/generic/pt-mutexattr-settype.c: Likewise.
* sysdeps/generic/pt-mutexattr.c: Likewise.
* sysdeps/generic/pt-once.c: Likewise.
* sysdeps/generic/pt-rwlock-attr.c: Likewise.
* sysdeps/generic/pt-rwlock-timedrdlock.c: Likewise.
* sysdeps/generic/pt-rwlock-timedwrlock.c: Likewise.
* sysdeps/generic/pt-rwlock-tryrdlock.c: Likewise.
* sysdeps/generic/pt-rwlock-trywrlock.c: Likewise.
* sysdeps/generic/pt-rwlock-unlock.c: Likewise.
* sysdeps/generic/pt-rwlockattr-getpshared.c: Likewise.
* sysdeps/generic/pt-rwlockattr-setpshared.c: Likewise.
* sysdeps/mach/hurd/pt-attr-setstackaddr.c: Likewise.
* sysdeps/mach/hurd/pt-attr-setstacksize.c: Likewise.
* sysdeps/mach/hurd/pt-hurd-cond-timedwait.c: Likewise.
|
|
* pthread/pt-create.c: Use IS_IN (libpthread) instead of IS_IN_libpthread
* pthread/pt-initialize.c: Likewise.
* pthread/pt-internal.h: Likewise.
|
|
* pthread/pt-create.c (__pthread_create_internal): When _dl_allocate_tls
returns NULL, set `err' to ENOMEM.
|
|
* pthread/pt-create.c: Include <hurd/resource.h>
(__pthread_create_internal): When `attr''s stacksize is 0, try to get
the desired size from the RLIMIT_STACK rlimit before defaulting to
PTHREAD_STACK_DEFAULT.
* sysdeps/generic/pt-attr.c (__pthread_default_attr): Set stacksize to
0 instead of PTHREAD_STACK_DEFAULT.
|
|
* pthread/pt-create.c (__pthread_create_internal): On thread creation
failure, take guard size into account when deallocating the stack.
* sysdeps/mach/pt-thread-terminate.c (__pthread_thread_terminate): Take
guard size into account when deallocating the stack.
|
|
* pthread/pt-create.c (__pthread_create_internal): Round guardsize up to
page size. Fill `guardsize' field of thread structure.
* sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Add guardsize to
computation of the top of the stack.
|
|
POSIX says guardsize is in addition to stacksize, not included.
* pthread/pt-create.c (__pthread_create_internal): Use setup->guardsize
+ setup->stacksize as stack allocation size. Do not truncate guardsize
to stacksize.
* pthread/pt-internal.h (guardsize): Remove comment.
* sysdeps/generic/pt-attr-setstacksize.c (pthread_attr_setstacksize): Do
not truncate guardsize to stacksize.
|
|
* pthread/pt-alloc.c (initialize_pthread): Reset resolver state.
* pthread/pt-create.c: Include <resolv.h>.
(entry_point): Update the __resp TLS variable to point to the resolver
state of the current thread.
* pthread/pt-internal.h: Define __need_res_state and include <resolv.h>.
(struct __pthread): New `res_state' member.
|
|
Releasing a thread reference uses a mutex, which means the kernel
resources used for synchronization must be available until late during
the destruction process. For simplicity, merge __pthread_thread_dealloc
into __pthread_thread_terminate.
* Makefile (libpthread-routines): Remove pt-thread-dealloc.
* pthread/pt-create.c (__pthread_create_internal): Remove call to
__pthread_thread_dealloc.
* pthread/pt-exit.c (__pthread_exit): Likewise.
* pthread/pt-internal.h (__pthread_thread_dealloc): Remove declaration.
(__pthread_thread_terminate): Update description.
* sysdeps/mach/pt-thread-dealloc.c: Remove file.
* sysdeps/mach/pt-thread-terminate.c (__pthread_thread_terminate):
Destroy the wake up port.
|
|
This change makes libpthread release almost every resource allocated for
a thread, including the kernel thread, its send right, its reply port
and its stack. This improves resource usage after peaks of activity
during which servers can create hundreds or even thousands of threads.
To achieve this, the library relies on the recently added
thread_terminate_release one-way GNU Mach RPC, which allows threads to
release their last resources along with terminating in a single
operation. The pthread_exit function unconditionally releases all the
resources it can, including other kernel objects (namely the port used
for blocking and waking up) and signal states. When releasing the
pthread structure, a reference counter is used so that joinable threads
remain available. Once the reference counter drops to 0, the pthread
structure can be recycled. Thread local storage (TLS) is also recycled
since it needs to remain allocated while terminating the thread, as it
is there that the reply port is stored. TLS could be released too, after
grabbing the reply port name, but it is difficult to make sure no RPC
involving a reply port is used afterwards, so the simpler solution of
recycling TLS was chosen.
* Makefile (libpthread-routines): Replace pt-thread-halt with
pt-thread-terminate.
* pthread/pt-alloc.c (initialize_pthread): Set reference counter and
unconditionally initialize new threads completely.
(__pthread_alloc): Remove call to __pthread_thread_halt, update calls
to initialize_pthread.
* pthread/pt-create.c (__pthread_create_internal): Don't attempt to
reuse stacks, handle reference counter, update failure handling.
* pthread/pt-dealloc.c: Include bits/pt-atomic.h.
(__pthread_dealloc): Make pthread structure available for reuse when
reference counter reaches 0.
* pthread/pt-detach.c (pthread_detach): Assume the target thread takes
care of its own resources and, as a result, simply unreference its
pthread struct.
* pthread/pt-exit.c (__pthread_exit): Release resources and terminate.
* pthread/pt-internal.h (struct __pthread): New `nr_refs' member.
(__pthread_alloc): Update description.
(__pthread_dealloc): Likewise.
(__pthread_thread_dealloc): Likewise.
(__pthread_thread_terminate): New declaration.
* pthread/pt-join.c (pthread_join): Assume the target thread takes care
of its own resources and, as a result, simply unreference its pthread
struct.
* sysdeps/mach/hurd/pt-sigstate-destroy.c
(__pthread_sigstate_destroy): Call _hurd_sigstate_delete.
* sysdeps/mach/hurd/pt-sigstate-init.c (__pthread_sigstate_init): Call
_hurd_thread_sigstate and _hurd_sigstate_set_global_rcv when
appropriate.
* sysdeps/mach/hurd/pt-sysdep.c (__pthread_create_internal): Prevent
the library from releasing the stack of the main thread.
* sysdeps/mach/hurd/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Remove
`have_kernel_resources' from the list of sysdep members.
* sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Update
thread allocation.
* sysdeps/mach/pt-thread-dealloc.c (__pthread_thread_dealloc): Update
description.
* sysdeps/mach/pt-thread-halt.c: Remove file.
* sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Fix the
conditions under which a thread should actually be started.
* sysdeps/mach/pt-thread-terminate.c: New file.
|
|
* pthread/pt-create.c (__pthread_create_internal): When the user provides a
`stackaddr`, use it instead of allocating a stack.
* pthread/pt-detach.c (pthread_detach): Only deallocate the stack when it
was allocated by libpthread.
* pthread/pt-join.c (pthread_join): Likewise.
|
|
|
|
Since libc functions used up to actual thread termination (including the
termination RPC itself) are to use TLS.
* pthread/pt-alloc.c (initialize_pthread): Set `tcb` field of `new` to NULL.
(__pthread_alloc): Deallocate TLS of to-be-reused `new` thread.
* pthread/pt-create.c (__pthread_create_internal): Reset `tcb` field to NULL
after deallocation.
* pthread/pt-exit.c (__pthread_exit): Do not deallocate TLS.
|
|
* pthread/pt-create.c (__pthread_create_internal): Store pthread ID in
caller-provided memory before starting the new thread.
|
|
* pthread/pt-create.c (entry_point) [IS_IN_libpthread]: Call __ctype_init.
|
|
ENOMEM can be returned if some malloc fail, but it is not a valid POSIX error number for pthread_create;
thus turn it to EAGAIN.
* pthread/pt-create.c (pthread_create): Turn ENOMEM to EAGAIN.
|
|
* sysdeps/mach/hurd/pt-sysdep.h (_HURD_THREADVAR_THREAD): Remove macro.
(___pthread_self): Declare new __thread variable.
(_pthread_self): Take self pointer from ___pthread_self instead of
threadvar.
* sysdeps/mach/hurd/pt-sysdep.c (___pthread_self): Define new __thread
variable.
(init_routine): Set ___pthread_self to initial thread structure.
* pthread/pt-internal.h (__pthread_setup): Add `self' parameter to
`entry_point' parameter.
* pthread/pt-create.c (entry_point): Add `self' parameter. Store it in
___pthread_self.
* sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Add `self parameter to
`entry_point' parameter. Pass it the `thread' parameter.
(__pthread_setup): Likewise.
* sysdeps/l4/hurd/powerpc/pt-setup.c (struct start_info): Add `self' field.
(first_entry_1): Pass `self' parameter.
(stack_setup): Add `self' parameter to `entry_point' parameter, pass it the
`thread' parameter.
(__pthread_setup): Likewise.
* sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Pass `thread' parameter
to the start routine.
(stack_setup): Add `self' parameter to `entry_point' paramter.
|
|
This avoids a conflict with glibc-provided bits/atomic.h
* sysdeps/ia32/bits/atomic.h: Rename to...
* sysdeps/ia32/bits/pt-atomic.h: ... this.
* pthread/pt-create.c: Include <bits/pt-atomic.h> instead of <bits/atomic.h>
* pthread/pt-exit.c: Likewise.
* pthread/pt-internal.h: Likewise.
|
|
Conflicts:
ChangeLog
Makefile
pthread/pt-exit.c
pthread/pt-internal.h
sysdeps/mach/hurd/ia32/pt-setup.c
sysdeps/mach/hurd/pt-docancel.c
sysdeps/mach/hurd/pt-sysdep.h
|
|
* Makefile (CFLAGS): Define ENABLE_TLS.
* pthread/pt-create.c (__pthread_create_internal) [ENABLE_TLS]: Call
into glibc to allocate static TLS block.
* pthread/pt-exit.c (pthread_exit) [ENABLE_TLS]: Call into glibc to
deallocate static TLS block.
* pthread/pt-internal.h [ENABLE_TLS] (tcbhead_t): New structure; as in
glibc.
(__pthread) [ENABLE_TLS]: Add TCB member.
[ENABLE_TLS] (_dl_allocate_tls, _dl_deallocate_tls): Declare; from
glibc.
* sysdeps/mach/hurd/pt-sysdep.h (__thread_set_pcsp): Rename to
__thread_set_pcsptp. Add SET_TP and TP parameters. Change all
callers.
* sysdeps/mach/hurd/i386/pt-machdep.c (__thread_set_pcsptp): Imlement
TLS support.
* sysdeps/mach/hurd/i386/pt-setup.c (__pthread_setup): Likewise.
|
|
* pthread/pt-alloc.c: Don't include <bits/atomic.h>.
(__pthread_free_threads): Change to a struct __pthread *.
(__pthread_free_threads_lock): New variable.
(__pthread_alloc): When looking for a TCB to reuse, iterate over
__pthread_free_threads taking the first for which the STATE field
is PTHREAD_TERMINATED. When reusing a TCB, first call
__pthread_thread_halt on it.
* pthread/pt-dealloc.c: Don't include <bits/atomic.h>.
(__pthread_free_threads): Change to a struct __pthread *.
(__pthread_free_threads_lock): New declaration.
(__pthread_dealloc): Enqueue PTHREAD on __PTHREAD_FREE_THREADS.
Set PTHREAD->STATE to PTHREAD_TERMINATED after everything else.
* pthread/pt-join.c (pthread_join): Call __pthread_thread_halt
before destroying the thread. When destroying the thread, call
__pthread_thread_dealloc on it.
* pthread/pt-detach.c (pthread_detach): If destroying the thread,
call __pthread_thread_halt before deallocating the stack. In this
case, also call __pthread_thread_dealloc on the tcb.
* pthread/pt-exit.c (pthread_exit): Call __pthread_dealloc only if
the thread is detached and then as the last thing we do before
calling __pthread_thread_halt.
* pthread/pt-internal.h (__pthread_thread_halt): Remove argument
NEED_DEALLOC. Update users.
* sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt): Remove
argument need_dealloc.
* sysdeps/mach/hurd/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Add field
have_kernel_resources.
* sysdeps/mach/hurd/pt-thread-alloc.c (__pthread_thread_alloc): If
THREAD->HAVE_KERNEL_RESOURCES is true, just return. After
allocating the resources, set THREAD->HAVE_KERNEL_RESOURCES to
true.
|
|
Merge changes from hurd-l4 fork.
* Makefile (SRCS): Add pt-startup.c and pt-mutex-transfer-np.c.
(sysdeps_headers): Add pthread-np.h.
2008-08-12 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/bits/pthread-np.h: New file.
2008-08-12 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/pt-startup.c: New file.
2008-08-12 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/bits/mutex.h (__PTHREAD_RECURSIVE_MUTEX_INITIALIZER):
Define.
(__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): Don't define.
* include/pthread/pthread.h
(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) [__USE_GNU]: Define.
(PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP): Don't define.
2008-08-12 Neal H. Walfield <neal@gnu.org>
* include/pthread/pthread.h: Include <sys/cdefs.h>.
(__extern_inline): If not defined, define appropriately.
2008-06-01 Neal H. Walfield <neal@gnu.org>
* include/pthread/pthread.h (PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP):
New definition.
* sysdeps/generic/bits/mutex.h
(__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): New definition.
* sysdeps/generic/bits/mutex-attr.h (__pthread_recursive_mutexattr):
New definition.
* sysdeps/generic/pt-mutexattr.c (__pthread_recursive_mutexattr):
New declaration.
* sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): If ATTR
is &__PTHREAD_RECURSIVE_MUTEXATTR, don't allocate a copy, just
save in MUTEX->ATTR.
* sysdeps/generic/pt-mutex-destroy.c (_pthread_mutex_destroy): If
MUTEX->ATTR is &__PTHREAD_RECURSIVE_MUTEXATTR, don't free it.
2008-05-29 Thomas Schwinge <tschwinge@gnu.org>
* sysdeps/generic/sem-timedwait.c: Don't include <error.h>.
2008-05-21 Neal H. Walfield <neal@gnu.org>
* include/pthread/pthread.h: Include <bits/pthread-np.h>.
2008-03-01 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/pt-mutex-transfer-np.c: New file.
* pthread/pt-self.c (pthread_self): Assert that SELF is not NULL.
2007-12-23 Neal H. Walfield <neal@gnu.org>
* pthread/pt-join.c (pthread_join): Cast argument to
pthread_cleanup_push to avoid warning.
2007-11-23 Neal H. Walfield <neal@gnu.org>
* pthread/pt-internal.h (__pthread_startup): Add declaration.
* pthread/pt-create.c (entry_point): Call __pthread_startup.
|
|
* pthread/pt-internal.h (__pthread_startup): Add declaration.
* pthread/pt-create.c (entry_point): Call __pthread_startup.
* sysdeps/l4/hurd/pt-sysdep.h: Include <hurd/storage.h> and
<sys/mman.h>.
(PTHREAD_SYSDEP_MEMBERS): Add fields object,
exception_handler_stack and exception_handler_sp.
(__attribute__): Call munmap.
* sysdeps/l4/hurd/ia32/pt-setup.c (__pthread_setup): Set up
thread->exception_handler_sp. Don't set the user define handle
here.
* sysdeps/l4/hurd/pt-startup.c: New file. Do it here.
* sysdeps/l4/hurd/pt-thread-alloc.c: New file.
* sysdeps/l4/hurd/pt-thread-halt.c: New file.
* sysdeps/l4/hurd/pt-thread-start.c: New file.
* Makefile.am (libpthread_a_SOURCES): Add pt-startup.c.
* sysdeps/l4/pt-block.c: Include <hurd/stddef.h>.
(__pthread_block): Detect IPC failure. Add debugging output.
* sysdeps/l4/pt-wakeup.c: Include <hurd/stddef.h>.
(__pthread_wakeup): Detect IPC failure. Add debugging output.
|
|
Merge changes from mainline Hurd. Update L4 bits to compile with
those changes.
* sysdeps/l4/pt-block.c (__pthread_block): Call l4_receive, not
L4_Receive.
* sysdeps/l4/pt-create-np.c (pthread_create_from_l4_tid_np): Don't
pass TID to __pthread_create_internal. Emit a warning.
* sysdeps/l4/pt-stack-alloc.c (allocate_page): Remove function.
(__pthread_stack_alloc): Don't require that STACKSIZE is equal to
__pthread_stacksize. Call mmap.
* sysdeps/l4/pt-thread-halt.c (__pthread_thread_halt): Take
additional argument, need_dealloc. Call __pthread_dealloc. Stop
the thread.
* sysdeps/l4/hurd/pt-sysdep.c (init_routine): When calling
__pthread_create_internal, don't pass the tid.
* tests/test-1.c (main): Use pthread_mutex_init, not
PTHREAD_MUTEX_INITIALIZER.
* pthread/pt-alloc.c: Don't include <bits/atomic.h>. Include
<atomic.h>.
(__pthread_free_threads): Make it an atomicptr_t, not an
__atomicptr_t.
(__pthread_alloc): Don't use __atomicptr_compare_and_swap, use
atomic_compare_and_exchange_val_acq.
* pthread/pt-create.c: Don't include <bits/atomic.h>. Include
<atomic.h>.
(__pthread_total): Make it an atomic_fast32_t, not an __atomic_t.
(__pthread_create_internal): Use atomic_increment and
atomic_decrement, not __atomic_inc and __atomic_dec.
* pthread/pt-dealloc.c: Don't include <bits/atomic.h>. Include
<atomic.h>.
(__pthread_free_threads): Make it an atomicptr_t, not an
__atomicptr_t.
(__pthread_dealloc): Use atomic_compare_and_exchange_val_acq, not
__atomicptr_compare_and_swap.
* pthread/pt-exit.c: Don't include <bits/atomic.h>. Include
<atomic.h>.
(pthread_exit): Use atomic_decrement_and_test, not
__atomic_dec_and_test.
* pthread/pt-internal.h: Don't include <bits/atomic.h>. Include
<atomic.h>.
(__pthread_total): Make it an atomic_fast32_t, not an __atomic_t.
* sysdeps/powerpc/bits/atomic.h: Remove file.
* sysdeps/ia32/bits/atomic.h: Likewise.
|
|
* pthread/pt-create.c (__pthread_total): Change type to uatomic32_t.
* pthread/pt-internal.h (__pthread_total): Likewise in declaration.
|
|
* pthread/pt-internal.h: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_total): Change type of declaration to uatomic_max_t.
* pthread/pt-alloc.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_free_threads): Change type to uatomicptr_t.
(__pthread_alloc): Call atomic_compare_and_exchange_val_acq
instead of __atomicptr_compare_and_swap.
* pthread/pt-create.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_total): Change type to uatomic_max_t.
(__pthread_create_internal): Call atomic_increment, not
__atomic_inc and atomic_decrement, not __atomic_dec.
* pthread/pt-dealloc.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_free_threads): Declare as uatomicptr_t.
(__pthread_dealloc): Call atomic_compare_and_exchange_val_acq
instead of __atomicptr_compare_and_swap.
* pthread/pt-exit.c: Include <atomic.h>, not <bits/atomic.h>.
(pthread_exit): Call atomic_decrement_and_test instead of
__atomic_dec_and_test.
* sysdeps/l4/pt-create-np.c: Do not include <bits/atomic.h>.
|
|
* libpthread: New directory, populated with Neal H. Walfields
pthread implementation.
|
|
2005-05-04 Neal H. Walfield <neal@gnu.org>
* Makefile (SRCS): Add pt-thread_dealloc.c.
* sysdeps/mach/pt-thread-dealloc.c: New file.
* pthread/pt-internal.h (__pthread_thread_dealloc): New
declaration.
(__pthread_thread_halt): Add parameter NEED_DEALLOC. Update
callers.
* sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt): Respect
new NEED_DEALLOC parameter. Move code which deallocates kernel
resources from here ...
* sysdeps/mach/pt-thread-dealloc.c (__pthread_thread_dealloc):
...to here.
* pthread/pt-create.c (__pthread_create_internal): Call
__pthread_thread_dealloc on failure.
* pthread/pt-exit.c (pthread_exit): Call __pthread_thread_dealloc.
* sysdeps/mach/pt-thread-alloc.c (create_wakeupmsg): Call
__mach_port_destroy to deallocate the receive right.
__mach_port_deallocate won't do it.
* pthread/pt-detach.c (pthread_detach): Don't call
__pthread_thread_halt a second time.
* sysdeps/mach/hurd/pt-sysdep.c (_cthread_init_routine): Fix
declaration.
(init_routine): Update declaration and remove gratuitous cast.
|
|
2005-05-02 Neal H. Walfield <neal@gnu.org>
* pthread/pt-alloc.c (__pthread_alloc): Set the thread id to the
table index plus one.
* pthread/pt-internal.h (__pthread_getid): Index __pthread_threads
using THREAD - 1, not THREAD.
(__pthread_setid): Likewise.
* pthread/pt-create.c (__pthread_create_internal): Likewise.
* sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock):
When returning EBUSY, don't forget to first unlock MUTEX->__HELD.
|
|
* pthread/pt-create.c [HAVE_USELOCAL]: Include <locale.h>.
(entry_point) [HAVE_USELOCALE]: Initialize the thread to the
global locale.
|
|
|