summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd
AgeCommit message (Collapse)Author
2011-09-07Tiny build and GCC warning fixes.Thomas Schwinge
* 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.
2009-04-072008-08-16 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* 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.
2009-04-072008-08-12 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
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.
2009-04-072007-11-20 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
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.
2009-04-062004-03-17 Marcus Brinkmann <marcus@gnu.org>Marcus Brinkmann
* libpthread: New directory, populated with Neal H. Walfields pthread implementation.
2008-08-03 * sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Fix cast fromSamuel Thibault
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.
2008-07-01Update copyright years.Thomas Schwinge
2008-05-272008-05-27 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Fix assert.
2008-02-292008-02-29 Samuel Thibault <samuel.thibault@ens-lyon.orgSamuel Thibault
* sysdeps/l4/hurd/i386/pt-setup.c (stack_setup): Align stack on 0x10 for MMX operations. * sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Likewise.
2005-05-12libpthread/Neal H. Walfield
2005-05-12 Neal H. Walfield <neal@gnu.org> * include/pthread/pthread.h (pthread_exit): Add noreturn attribute. * sysdeps/generic/bits/condition.h (__PTHREAD_COND_INITIALIZER): Don't create a compound literal. * sysdeps/generic/bits/mutex.h (__PTHREAD_MUTEX_INITIALIZER): Don't create a compound literal. (pthread_mutex_init): Don't assign to *__MUTEX directly. Initialize an intermediate local variable and then copy the result. * sysdeps/generic/bits/rwlock.h (__PTHREAD_RWLOCK_INITIALIZER): Don't create a compound literal. (pthread_rwlock_init): Don't assign to *__RWLOCK directly. Initialize an intermediate local variable and then copy the result. * sysdeps/i386/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER): Don't create a compound literal. * pthread/pt-alloc.c (initialize_pthread): Cast PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER to create a compound literal. * tests/test-1.c (main): Use pthread_mutex_init, not PTHREAD_MUTEX_INIT for mutex initialization * sysdeps/generic/pt-barrier-init.c (pthread_barrier_init): Remove assert. Copy ATTR if non-defaults are used. * sysdeps/generic/pt-cond-init.c (pthread_cond_init): Include <string.h>. Remove assert. Copy ATTR if non-defaults are used. * sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): Cast PTHREAD_MUTEX_INITIALIZER to create a compound literal. * sysdeps/generic/pt-rwlock-init.c: Include <string.h>. (_pthread_rwlock_init): Cast __PTHREAD_RWLOCK_INITIALIZER to create a compound literal. Copy ATTR if non-defaults are used. * sysdeps/generic/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): Check that ABSTIME->TV_NSEC is valid. Don't shadow ERR. Don't return before cleaning up. * sysdeps/generic/pt-mutex-timedlock.c (pthread_mutex_timedlock): Move after __pthread_mutex_timedlock_internal. Check that ABSTIME->TV_NSEC is valid. * sysdeps/generic/pt-rwlock-timedrdlock.c (pthread_rwlock_timedrdlock): Move after. __pthread_rwlock_timedrdlock_internal. (__pthread_rwlock_timedrdlock_internal): Check that ABSTIME->TV_NSEC is valid. * sysdeps/generic/pt-rwlock-timedwrlock.c (pthread_rwlock_timedwrlock): Move after __pthread_rwlock_timedwrlock_internal. (__pthread_rwlock_timedwrlock_internal): Check that ABSTIME->TV_NSEC is valid. * sysdeps/generic/sem-timedwait.c (__sem_timedwait_internal): Check that TIMEOUT->TV_NSEC is valid before enqueuing the thread. * sysdeps/generic/pt-rwlock-rdlock.c (__pthread_rwlock_timedrdlock_internal): Fix declaration. * sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock): Don't return EDEADLK. POSIX does not allow it. * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Calculate the relative timeout without overflowing. * sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Cast THREAD.
2005-05-04libpthread/Neal H. Walfield
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-01-18libpthread/Neal H. Walfield
2005-01-18 Neal H. Walfield <neal@gnu.org> * sysdeps/mach/hurd/pt-sysdep.h (__pthread_stack_dealloc): Add __always_inline__ attribute. * sysdeps/l4/hurd/pt-sysdep.h (_pthread_self): Likewise. (__attribute__): Likewise.
2002-11-252002-11-25 Neal H. Walfield <neal@cs.uml.edu>Neal H. Walfield
* sysdeps/mach/hurd/i386/pt-setup.c (__pthread_setup): Fix last change.
2002-11-182002-11-18 Neal H. Walfield <neal@cs.uml.edu>Neal H. Walfield
* sysdeps/mach/pt-wakeup.c (__pthread_wakeup): Use the size of THREAD->wakeupmsg which may not be a mach_msg_header_t. * sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Really test for equality. * 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-cond-timedwait.c (__pthread_cond_timedwait_internal): On timeout, remove our thread structure from the wait queue if necessary. * sysdeps/l4/pt-start.c (__pthread_start): Call L4_Myself, not __mach_thread_self. * sysdeps/mach/hurd/i386/pt-setup.c: Include <mach.h>. (__pthread_setup): Do not leak references from __mach_thread_self. * sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Likewise. * sysdeps/mach/hurd/pt-sysdep.h (_pthread_self): Likewise. * sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Likewise. * sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Likewise. * sysdeps/mach/pt-start.c: Remove dead file.
2002-10-10Import libpthread.Neal H. Walfield