Age | Commit message (Collapse) | Author |
|
|
|
* sysdeps/mach/pt-thread-terminate.c (__pthread_thread_terminate): Cast
stack address to vm_address_t before calling __thread_terminate_release.
|
|
* sysdeps/mach/hurd/pt-sigstate.c (__pthread_sigstate): Always remove
_SIG_CANT_MASK from blocked signals, like sigprocmask does.
|
|
|
|
* include/pthread/pthread.h: Prepend '__' to parameter names.
* sysdeps/mach/hurd/bits/pthread-np.h: Likewise.
|
|
* configure: New file
* include/libc-symbols.h: Remove file
* include/set-hooks: Remove file
* sysdeps/i386/bits/spin-lock-inline.h: Move to...
* b/sysdeps/mach/i386/bits/spin-lock-inline.h: ... here.
* sysdeps/i386/bits/spin-lock.h: Move to...
* b/sysdeps/mach/i386/bits/spin-lock.h: ... here.
|
|
(code grabbed from glibc)
* libpthread/sysdeps/mach/hurd/pt-sigstate.c: Include <hurd/msg.h>
(__pthread_sigstate): Use _hurd_sigstate_lock/unlock instead of
__pthread_spin_lock on `ss->lock'. Check _hurd_sigstate_pending and
send a message to the signal thread if needed.
|
|
* 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.
|
|
* sysdeps/mach/hurd/pt-hurd-cond-timedwait.c (err): Initialize to 0.
|
|
* sysdeps/mach/hurd/pt-sysdep.c (_init_routine): Call ___pthread_init
instead of __pthread_init.
|
|
* sysdeps/mach/hurd/pt-sysdep.c (_init_routine): Use `stack' parameter
instead of hardcoding __libc_stack_end.
|
|
* pthread/pt-internal.h: Include <ldsodefs.h>
(_dl_allocate_tls, _dl_deallocate_tls): Remove declarations.
* sysdeps/mach/hurd/pt-sysdep.c (init_routine): Rename into _init_routine,
add `stack' parameter, return if __pthread_threads is already initialized,
pass stack address to __pthread_create_internal if any.
(init_routine): New function, calls init_routine with 0
(dynamic_init_routine): New constructor function, calls init_routine with
__libc_stack_end.
|
|
To avoid clashing with the __pthread_init hook.
* pthread/pt-initialize.c (__pthread_init): Rename into ___pthread_init.
* pthread/pt-internal.h: Likewise.
* sysdeps/mach/hurd/pt-sysdep.c: Likewise.
|
|
* 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.
|
|
Unlike other threads, the TCB of the main thread is created by the C
library before libpthread is initialized and needs special care.
* sysdeps/mach/hurd/i386/pt-setup.c (__pthread_setup): Set the `self'
member of the main thread TCB.
|
|
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 reverts commit 414e0bbabb6ac7a5cff148b927ec874dff922be1.
It's these versions which would end up being installed. Some other way
needs to be found, or else we'll have to just duplicate or move the
content.
|
|
Using an i386 Implies would change inclusion order in the rest of libc
too, entailing a lot of issues. We can simply make mach/i386 include
i386 instead.
* sysdeps/mach/i386/bits/spin-lock-inline.h: Include
../../../sysdeps/i386/bits/spin-lock-inline.h.
* sysdeps/mach/i386/bits/spin-lock.h: Include
../../../sysdeps/i386/bits/spin-lock.h.
|
|
This reverts commit 40376cfa5d8bd4814b29b777a7d0a6b2b6ed2a7c.
|
|
* sysdeps/mach/hurd/i386/Implies: Add i386.
|
|
This would leak, but at least let the user reboot nicely into a newer
kernel.
* sysdeps/mach/pt-thread-terminate.c (__pthread_thread_terminate): If
__thread_terminate_release returns, use __thread_terminate to terminate the
thread anyway.
|
|
This reverts commit 536420a581f9f822cdef0fc460b5176a840f49e5.
Now that threadvars have been replaced with TLS, this hack is no
longer needed.
|
|
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.
|
|
|
|
* sysdeps/mach/pt-stack-alloc.c(__pthread_stack_alloc): Use `stacksize`
parameter instead of `__pthread_stacksize` global variable.
|
|
This new Hurd-specific function is meant to allow Hurd servers to wait
for events during a bounded period of time.
* Makefile (libpthread-routines): Add pt-hurd-cond-timedwait.
* Versions: Include pthread_hurd_cond_timedwait_np in version GLIBC_2.17
of libpthread.
* sysdeps/mach/hurd/bits/pthread-np.h (pthread_hurd_cond_timedwait_np): New
declaration.
* sysdeps/mach/hurd/pt-hurd-cond-timedwait.c: New file that provides
__pthread_hurd_cond_timedwait_internal and __pthread_hurd_cond_timedwait_np.
* sysdeps/mach/hurd/pt-hurd-cond-wait.c (__pthread_hurd_cond_wait_np):
Rewrite as a call to __pthread_hurd_cond_timedwait_internal with no timeout.
|
|
This patch solves two issues. The first one is cancellation handling
when a cancellation request is sent before reaching a cancellation
point (namely, pthread_cond_{timed,}wait). Cancellation is implemented
by pushing an appropriate cleanup handler and switching to
PTHREAD_CANCEL_ASYNCHRONOUS type. The main problem is that it doesn't
handle pending requests, only a cancellation that occurs while blocking.
Other problems occur when trying to correctly handle a timeout and a
cancellation request through the cleanup routine.
The other issue is correctly handling timeouts. This problem was already
well known, as explained by the following comment :
"FIXME: What do we do if we get a wakeup message before we disconnect
ourself? It may remain until the next time we block."
In addition, the prevp thread member is inconsistently used. It is
sometimes accessed while protected by the appropriate queue lock to
determine whether a thread is still queued, while at times, threads
are unqueued without holding a lock, as in pthread_cond_broadcast :
/* We can safely walk the list of waiting threads without holding
the lock since it is now decoupled from the condition. */
__pthread_dequeuing_iterate (wakeup, wakeup)
__pthread_wakeup (wakeup);
This is the root cause that triggers some assertion failures.
The solution brought by this patch is to consistently use the prevp link
to determine if both a thread has been unqueued and if a wakeup message
has been sent (both are needed to wake up a thread). A thread unblocked
because of a timeout can now accurately determine if it needs to drain
its message queue. A direct improvement is that the message queue size
can be limited to one message, and wakeups are guaranteed to be
non-blocking, which allows safely calling __pthread_wakeup from critical
sections.
As it now affects the cleanup cancellation routine of
__pthread_cond_timedwait_internal, cancellation is reworked as well.
Cancellation type is forced to PTHREAD_CANCEL_DEFERRED during the call,
and actually checked on both entry and return. A hook is set by the
blocking thread so that the waker doesn't need to know about the call
implementation. Cancellation members are now protected with a mutex for
truely safe access.
* pthread/pt-alloc.c (initialize_pthread): Initialize the new `cancel_lock',
`cancel_hook' and `cancel_hook_args' fields.
* pthread/pt-cancel.c (pthread_cancel): Rework cancellation handling.
* pthread/pt-internal.h (struct __pthread): Add `cancel_lock', `cancel_hook'
and `cancel_hook_args' fields.
(__pthread_dequeue): Assert thread->prevp isn't NULL.
* pthread/pt-join.c (pthread_join): Describe how the cancellation point is
implemented.
* pthread/pt-setcancelstate.c (__pthread_setcancelstate): Lock the given
thread cancellation lock when switching state.
* pthread/pt-setcanceltype.c (__pthread_setcanceltype): Likewise for
cancellation type.
* pthread/pt-testcancel.c (pthread_testcancel): Likewise for pending
cancellations.
* sysdeps/generic/pt-cond-brdcast.c (__pthread_cond_broadcast): Dequeue
and wake up threads with condition locked.
* sysdeps/generic/pt-cond-signal.c (cond_signal): Remove function, move
implementation to ...
(__pthread_cond_signal): ... this function. Remove unused `unblocked'
variable.
* sysdeps/generic/pt-cond-timedwait.c (struct cancel_ctx): New structure.
(cancel_hook): New static function.
(__pthread_cond_timedwait_internal): Fix cancellation and timeout handling.
* sysdeps/generic/pt-mutex-timedlock.c
(__pthread_mutex_timedlock_internal): Fix timeout handling.
* sysdeps/generic/pt-rwlock-timedrdlock.c
(__pthread_rwlock_timedrdlock_internal): Likewise.
* sysdeps/generic/pt-rwlock-timedwrlock.c
(__pthread_rwlock_timedwrlock_internal): Likewise.
* sysdeps/generic/pt-rwlock-unlock.c (pthread_rwlock_unlock): Dequeue and
wake up threads with rwlock internal lock held.
* sysdeps/generic/sem-timedwait.c (__sem_timedwait_internal): Fix timeout
handling.
* sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Unlock the given
thread cancellation lock.
* sysdeps/mach/pt-thread-alloc.c (create_wakeupmsg): Limit the message
queue size of the wakeup port to 1.
* sysdeps/mach/pt-wakeup.c (__pthread_wakeup): Call __mach_msg in a
non-blocking way.
|
|
This allows the use of glibc sysdeps that use pthread-based
implementations.
* sysdeps/mach/hurd/Implies: Add pthread.
|
|
This change is a temporary hack intended for the Hurd servers. Once Hurd
threadvars are replaced with TLS, this commit should be reverted.
* pthread/pt-internal.h (__pthread_default_attr): Remove const qualifier.
* sysdeps/generic/pt-attr.c (__pthread_default_attr): Likewise.
* sysdeps/mach/hurd/pt-sysdep.c (__pthread_stack_default_size): New variable.
(init_routine): Set __pthread_default_attr.stacksize if
__pthread_stack_default_size exists.
|
|
* Makefile (libpthread-routines): Add pt-hurd-cond-wait.
* Versions (libc): Add pthread_hurd_cond_wait_np.
(libpthread): Likewise.
* sysdeps/mach/hurd/bits/pthread-np.h: New file.
* sysdeps/mach/hurd/pt-hurd-cond-wait.c: Likewise.
|
|
* sysdeps/i386/Implies: Remove file.
* sysdeps/mach/hurd/i386/Implies: Likewise.
* sysdeps/ia32/bits/memory.h: Rename to sysdeps/i386/bits/memory.h.
* sysdeps/ia32/bits/pt-atomic.h: Rename to sysdeps/i386/bits/pt-atomic.h.
* sysdeps/ia32/bits/spin-lock-inline.h: Rename to
sysdeps/i386/bits/spin-lock-inline.h.
* sysdeps/ia32/bits/spin-lock.h: Rename to sysdeps/i386/bits/spin-lock.h.
* sysdeps/ia32/machine-sp.h: Rename to sysdeps/i386/machine-sp.h.
* sysdeps/ia32/pt-machdep.h: Rename to sysdeps/i386/pt-machdep.h.
* sysdeps/mach/hurd/ia32/pt-machdep.c: Rename to
sysdeps/mach/hurd/i386/pt-machdep.c.
* sysdeps/mach/hurd/ia32/pt-setup.c: Rename to
sysdeps/mach/hurd/i386/pt-setup.c.
* Makefile (SYSDEP_PATH): Adapt to that.
|
|
* 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.
|
|
The former conflicts with usage in glibc.
* pthread/pt-initialize.c (__pthread_initialize): Rename into
__pthread_init.
* pthread/pt-internal.h (__pthread_initialize): Likewise.
* sysdeps/l4/hurd/pt-sysdep.c (init_routine): Likewise.
* sysdeps/mach/hurd/pt-sysdep.c (init_routine): Likewise.
|
|
Use `clock_gettime' with the provided clock instead of `gettimeofday',
linking to rt.
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Switch to
`clock_gettime'.
* Makefile [!IN_GLIBC] (LDLIBS): Link to rt.
[IN_GLIBC] ($(objpfx)libpthread.so): Likewise.
* Makefile.am (libpthread_a_LDADD): Likewise.
|
|
To make `__pthread_timedblock' properly measure time using the right
clock, add a new argument representing the clock to use.
* pthread/pt-internal.h (__pthread_timedblock): New argument CLOCK_ID.
* sysdeps/l4/pt-timedblock.c (__pthread_timedblock): Likewise.
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Likewise.
* sysdeps/generic/pt-cond-timedwait.c
(__pthread_cond_timedwait_internal): Pass the clock of the
`pthread_cond' to `__pthread_timedblock'.
* sysdeps/generic/pt-mutex-timedlock.c
(__pthread_mutex_timedlock_internal): Pass CLOCK_REALTIME to
`__pthread_timedblock'.
* sysdeps/generic/pt-rwlock-timedrdlock.c
(__pthread_rwlock_timedrdlock_internal): Likewise.
* sysdeps/generic/pt-rwlock-timedwrlock.c
(__pthread_rwlock_timedwrlock_internal): Likewise.
* sysdeps/generic/sem-timedwait.c (__sem_timedwait_internal):
Likewise.
|
|
* Makeconfig, Versions, configure.in, forward.c, libc_pthread_init.c,
pthread/pthread-functions.h, shlib-versions, sysdeps/i386/Implies,
sysdeps/mach/hurd/Implies, sysdeps/mach/hurd/i386/Implies: New files.
* Makefile: Add glibc rules, enabled when IN_GLIBC is defined to yes, when
$(..) is defined.
* pthread/pt-initialize.c [IS_IN_libpthread] (pthread_functions): New variable.
[IS_IN_libpthread] (__pthread_initialize): Call __libc_pthread_init.
|
|
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/cthreads-compat.c: #include <stddef.h> for NULL.
* pthread/pt-exit.c (pthread_exit): Remove stray need_dealloc variable.
* sysdeps/generic/pt-attr-getschedparam.c: #include <string.h> for memcpy.
* sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Apply some more typecasting.
* tests/test-1.c: #include <assert.h>.
* tests/test-6.c: Likewise.
* tests/test-7.c: Likewise.
* tests/test-16.c (handler): Take parameters for sa_handler, not sa_sigaction.
|
|
* sysdeps/i386/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER): Rename
macro to...
(__PTHREAD_SPIN_LOCK_INITIALIZER): ... this.
* sysdeps/mach/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER): Rename
macro to...
(__PTHREAD_SPIN_LOCK_INITIALIZER): ... this.
* include/pthread/pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Use
__PTHREAD_SPIN_LOCK_INITIALIZER instead of
__SPIN_LOCK_INITIALIZER.
* sysdeps/generic/bits/condition.h (__PTHREAD_COND_INITIALIZER):
Likewise.
* sysdeps/generic/bits/mutex.h (__PTHREAD_MUTEX_INITIALIZER,
__PTHREAD_RECURSIVE_MUTEX_INITIALIZER):
Likewise.
* sysdeps/generic/bits/once.h (__PTHREAD_ONCE_INIT): Likewise.
* sysdeps/generic/bits/rwlock.h (__PTHREAD_RWLOCK_INITIALIZER):
Likewise.
* sysdeps/generic/bits/semaphore.h (__SEMAPHORE_INITIALIZER):
Likewise.
* sysdeps/i386/bits/spin-lock-inline.h (__pthread_spin_init):
Likewise.
* sysdeps/i386/mach/spin-lock-inline.h (__pthread_spin_init):
Likewise.
|
|
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock):
Fix timeout computation from abstime and now.
|
|
* sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Set
THREAD->HAVE_KERNEL_RESOURCES to 1, not true. Reported by Flávio
Cruz <Flávio Cruz>.
|
|
* 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 in Samuel Thibault's changes from the main line.
* Makefile.am (libpthread_a_SOURCES): Add pt-getattr.c.
* headers.m4: Link libpthread/include/pthread/pthreadtypes.h to
sysroot/include/pthread/pthreadtypes.h and
libpthread/sysdeps/${arch}/bits/spin-lock-inline.h. to
sysroot/include/bits/spin-lock-inline.h.
* include/pthread/pthread.h: Include <sys/cdefs.h>.
(__extern_inline): If not defined, define appropriately.
2008-08-04 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthreadtypes.h (__pthread_inheritsched): Remove
comma at end of enumeration.
2008-08-03 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Makefile (sysdeps_headers): Add spin-lock-inline.h.
(SYSDEP_PATH): Move sysdeps/ia32 right after
sysdeps/$(MICROKERNEL)/ia32.
* include/pthread/pthread.h: Include <bits/spin-lock-inline.h>.
* sysdeps/ia32/bits/spin-lock.h: Move inlines to...
* sysdeps/ia32/bits/spin-lock-inline.h: ... new file.
2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/generic/bits/mutex.h: Do not include <errno.h> and
<stddef.h>
* sysdeps/ia32/bits/memory.h (__memory_barrier): Add memory clobber.
* sysdeps/ia32/bits/spin-lock.h (__pthread_spin_trylock,
__pthread_spin_unlock): Add memory clobbers.
* sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Fix reservation of
stack room for initial frame.
2008-07-18 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Makefile (sysdeps_headers): add pthread/pthreadtypes.h
2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h: Do not define __need_clockid_t, include
<time.h>, and define clockid_t if __clockid_defined is not defined.
Include <pthread/pthreadtypes.h>
(pthread_equal): New extern inline.
(pthread_cleanup_push, pthread_cleanup_pop): New macros.
(__pthread_process_shared, __pthread_inheritsched,
__pthread_contentionscope, __pthread_detachstate,
__pthread_mutex_protocol, __pthread_mutex_type,
pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t,
pthread_condattr_t, pthread_cond_t, pthread_spinlock_t,
pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t,
pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and
typedefs to...
* include/pthread/pthreadtypes.h: ... new file.
* sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename
macro to __pthread_cleanup_push.
(pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop.
* sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared):
Forward-declare enum.
* sysdeps/generic/bits/condition-attr.h (__pthread_process_shared):
Likewise.
* sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol,
__pthread_process_shared, __pthread_mutex_type):
Likewise.
* sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared):
Likewise.
* sysdeps/generic/bits/thread-attr.h (__pthread_detachstate,
__pthread_inheritsched, __pthread_contentionscope):
Likewise.
* sysdeps/generic/bits/pthread.h (pthread_t): Rename type to
__pthread_t.
(pthread_equal): Rename to __pthread_equal.
2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/generic/bits/thread-barrier.h: Remove unused file.
2008-05-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h (pthread_getattr_np): New declaration.
* pthread/pt-getattr.c: New file.
* Makefile (SRCS): Add pt-getattr.c.
2008-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/libc-symbols.h (HAVE_ASM_PREVIOUS_DIRECTIVE): Define.
2008-02-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Align stack on 0x10
for MMX operations.
2008-01-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h (pthread_spin_destroy, pthread_spin_init,
pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): Use
__extern_inline macro instead of extern __inline.
* sysdeps/ia32/bits/spin-lock.h (__PT_SPIN_INLINE,
__pthread_spin_lock): Likewise
* sysdeps/generic/bits/pthread.h (pthread_equal): Declare ; only
provide inline when __USE_EXTERN_INLINES is defined. Use __extern_inline
macro instead of extern __inline.
* sysdeps/ia32/bits/memory.h (__memory_barrier): Add static to inline.
|
|
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.
|
|
* libpthread: New directory, populated with Neal H. Walfields
pthread implementation.
|
|
(SYSDEP_PATH): Move sysdeps/i386 right after
sysdeps/$(MICROKERNEL)/i386.
* include/pthread/pthread.h: Include <bits/spin-lock-inline.h>.
* sysdeps/i386/bits/spin-lock.h: Move inlines to...
* sysdeps/i386/bits/spin-lock-inline.h: ... new file.
* sysdeps/mach/bits/spin-lock.h: Move inlines to...
* sysdeps/mach/bits/spin-lock-inline.h: ... new file.
|
|
thread to integer. Fix reservation of stack room for initial frame.
* sysdeps/l4/hurd/i386/pt-setup.c (stack_setup): Fix reservation of
stack room for initial frame.
|
|
|