summaryrefslogtreecommitdiffstats
path: root/lib/librthread/Makefile (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Instead of opting in to futexes on archs with atomics opt out on archsjsg2020-02-061-10/+7
| | | | | | without atomics, a smaller list. ok mpi@ visa@
* New futex(2) based rwlock implementation based on the mutex code.mpi2019-02-131-4/+6
| | | | | | | | | This implementation reduces contention because threads no longer need to spin calling sched_yield(2) before going to sleep. Tested by many, thanks! ok visa@, pirofti@
* Move sigwait(3) from libpthread to libcjca2019-01-121-2/+1
| | | | | | | | POSIX wants it in libc, that's where the function can be found on other systems. Reported by naddy@, input from naddy@ and guenther@. "looks ok" guenther@, ok deraadt@ Note: riding the libc/libpthread major cranks earlier today.
* Switch alpha to futex(2) based condvars, mutexes and semaphores.visa2018-10-211-5/+6
| | | | From Brad, tested by Miod, OK kettenis@
* Switch powerpc to futex(2) based condvars, mutexes and semaphores.visa2018-10-151-2/+2
| | | | From Brad, OK mpi@ kettenis@
* enable futex(2) based mutexes on armv7 and use futex based semaphores injsg2018-09-241-3/+3
| | | | | librthread on armv7 as well from brad ok visa@ kettenis@ mpi@
* New semaphore implementation making sem_post async-safe.pirofti2018-06-081-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX dictates that sem_post() needs to be async-safe here[0] and is thus included in the list of safe functions to call from within a signal handler here[1]. The old semaphore implementation is using spinlocks and __thrsleep to synchronize between threads. Let's say there are two threads: T0 and T1 and the semaphore has V=0. T1 calls sem_wait() and it will now sleep (spinlock) until someone else sem_post()'s. Let's say T0 sends a signal to T1 and exits. The signal handler calls sem_post() which is meant to unblock T1 by incrementing V. With the old semaphore implementation we we are now in a deadlock as sem_post spinlocks on the same lock. The new implementation does not suffer from this defect as it uses futexes to resolve locking and thus sem_post does not need to spin. Besides fixing this defect and making us POSIX compliant, this should also improve performance as there should be less context switching and thus less time spent in the kernel. For architectures that do not provied futexes and atomic operations, the old implementation will be used and it is now being renamed to rthread_sem_compat as discussed with mpi@. [0] -- http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_post.html [1] -- http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html OK visa@, mpi@, guenther@
* Move the thread-related .h files to /usr/src/include/, since theguenther2017-10-151-2/+1
| | | | | | | implementation is now spread between libc and librthread. No changes to the content ok mpi@
* Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther2017-09-051-18/+1
| | | | | | | | pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
* Enable the use of futex(2) in librthread on mips64.visa2017-07-041-2/+3
| | | | OK mpi@, deraadt@
* Re-enabled futex based condvar & mutexes, they are not the cause ofmpi2017-06-011-2/+9
| | | | vmd(8)'s regression.
* New condvar introduced a regression with vmd(8), revert until it is found.mpi2017-06-011-9/+2
| | | | Reported by Gregor Best.
* Enable futex-based mutex and condvar.mpi2017-05-291-2/+9
| | | | ok everybody
* implicit function declaration is the error we really want, not thetedu2016-06-011-2/+2
| | | | annoying strict prototypes
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-071-4/+5
| | | | | | | | | | | | | | | | | This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
* Wrap <pthread.h> and <pthread_np.h> to eliminate PLT entries for internalguenther2016-04-021-2/+5
| | | | | | | references. Use _thread_pagesize for the semaphore mmap size instead of calling getpagesize() each time. ok beck@
* Instead of testing for __ELF__ and/or vax, leave out the bits for interfacingguenther2015-05-191-1/+5
| | | | | | | with ld.so locking whenever building NOPIC pointless use of __ELF__ noted by brad@ ok miod@
* zap trailing newlines; "go for it" deraadtokan2014-07-161-2/+1
|
* __tfork_thread is in libc, so move the manpage over tooguenther2014-07-101-4/+1
| | | | ok deraadt@
* Remove support for COMPILER_VERSION == gcc2.miod2013-08-061-8/+2
| | | | | | | | Change the logic depending upon COMPILER_VERSION everywhere, to assume gcc4 is the norm and to explicitely test for gcc3 when a different behaviour is required. No functional change intended. Be sure to `make install' in share/mk before attempting to do anything.
* ELF_TOOLCHAIN bye bye.miod2013-07-051-4/+3
|
* Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,guenther2013-06-171-1/+2
| | | | | | | | including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and {clock,pthread}_getcpuclockid() functions. Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@ ok matthew@
* Do not pass -Wmissing-prototypes when building on a non-ELF platform withmiod2012-11-221-3/+4
| | | | | gcc 3 as the compiler. The way constructors are built triggers this warning, which is fatal because of -Werror. ok espie@ guenther@
* Define empty CDIAGFLAGS for programs that use Werror.haesbaert2012-09-121-1/+2
| | | | | | Makes "make build" build with WARNINGS=Yes on amd64. ok espie
* A couple small but long anticipated changes:matthew2012-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | - Link libpthread.so with -znodlopen. Because libpthread overrides the weak symbols in libc, we can't allow it to be dynamically loaded or else libc's weak symbols might have already been resolved by ld.so. (Also, major bump because this is technically a backwards incompat change in behavior, although dlopen()ing libpthread never really worked.) - Link libc.so with -nodefaultlibs -lgcc. This ensures that libc doesn't try to link against itself (which ld.so wouldn't like). - Change GCC 4 to link shared objects with -lpthread and -lc as appropriate, now that there's no issues with doing so. This means that it's no longer necessary to patch software to use -pthread instead of -lpthread. (Ports tree rejoice!) Also, to preemptively answer this question: No, this does not eliminate the need for LD_PRELOAD=libpthread.so. That's a separate issue that won't be resolved until we eliminate libc's weak symbols. Discussed extensively on email and icb over the past few months. ok deraadt
* remove leftover NOLINT, WANTLINT, LINTFLAGS, LOBJ vars and lint targets.okan2012-08-021-3/+1
| | | | ok guenther@
* Add pthread spinlock support.pirofti2012-05-031-1/+2
| | | | | | | | | | | Implementation, documentation and naive regression tests for: - pthread_spin_init() - pthread_spin_destroy() - pthread_spin_lock() - pthread_spin_trylock() - pthread_spin_unlock() Implementation okay guenther@, documentation okay jmc@.
* Add pthread barrier support.pirofti2012-04-111-1/+3
| | | | | | | | | | | | | | | Implementation and documentation for: - pthread_barrier_init() - pthread_barrier_destroy() - pthread_barrier_wait() - pthread_barrierattr_init() - pthread_barrierattr_destroy() - pthread_barrierattr_getpshared() - pthread_barrierattr_setpshared() Currently only private barriers are supported. Okay guenther@.
* Move __tfork_thread() from rthreads (libpthread) to libc so thatguenther2012-03-221-2/+2
| | | | | | it can be used for not-strictly-threading purposes ok matthew@ kurt@
* Add pthread_condattr_{get,set}clock(), requested by aja@guenther2012-02-231-7/+22
| | | | Add pthread_mutex_timedlock(), requested by dcoppa@
* Extend miod's fix CFLAGS fix to all gcc2 platforms (suggested by Tobiasguenther2012-02-191-3/+5
| | | | Ulmer). Only pull in bsd.lib.mk once to avoid linking objects twice
* Work around compiler confusion while building rthread.o on vax.miod2012-02-181-2/+6
|
* Nothing important, just switching from pthreads to rthreadsguenther2012-02-151-2/+7
|
* Split out the semaphore functions.mpi2012-01-041-2/+3
| | | | ok guenther@
* Add pthread_mutex_{get,set}prioceiling()guenther2011-12-221-2/+2
|
* Split out the pthread_rwlock* and pthread_once() functions from rthread_sync.cguenther2011-12-211-2/+3
| | | | to new files rthread_rwlock.c, rthread_rwlockattr.c, and rthread_once.c
* Split out the pthread_mutexattr_* functions from rthread_sync.c toguenther2011-12-211-2/+2
| | | | | | | new file rthread_mutexattr.c. Add basic implementations of pthread_mutexattr_{set,get}{protocol,prioceiling} Requested by aja
* Implement cancelation for the basic syscall cancelation points,guenther2011-12-051-2/+3
| | | | | | using previously allocated SIGTHR to interrupt in-process syscalls and fixing the spelling of "cancelled" along the way. Modeled on FreeBSD's libthr
* Set the initfirst and nodelete flags on the shared library, in anticipationguenther2011-11-271-1/+2
| | | | of support in ld.so
* Copy support for sched_get_priority_{min,max} from libpthread.guenther2011-11-061-2/+2
| | | | Requested by many to ease substitution of librthread for libpthread
* Use __tfork, __get_tcb, and __set_tcb to have a real TCB and per-threadguenther2011-10-171-3/+6
| | | | | errno. The ASM bits for _cerror are sketchy or missing for some archs but that can be corrected in-tree.
* Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependentmiod2010-02-031-2/+2
| | | | | | | files or directories when applicable. The inspiration and name of MACHINE_CPU come from NetBSD, although the way to provide it to Makefiles is completely different. ok kettenis@
* Change threxit() to take a pointer to a pid_t to zero out from theguenther2009-11-271-2/+2
| | | | | | | | | | kernel so that librthread can detect when a thread is completely done with its stack without need a kqueue. The dying thread moves itself to a GC list, other threads scan the GC list on pthread_create() and pthread_join() and free the stack and handle once the thread's thread id is zeroed. "get it in" deraadt@, tedu@, cheers by others
* Add f*lockfile() routines to librthreadguenther2009-10-211-2/+2
| | | | ok kurt@
* apparently all the other libraries get linted, so I'll just have to live with ittedu2009-02-201-2/+2
|
* the lint warnings are more annoying than anything else. we already have a full set of warnings from the compilertedu2009-02-201-2/+2
|
* - Add fork/vfork wrapper functions to reset state in the child process.kurt2008-06-051-2/+2
| | | | | | | | | | | - Make an effort to protect important libc and ld.so critical areas during the fork(2)/vfork(2) sys call. - Add pthread_atfork(3) implementation based on Daniel Eischen's code. Original diff by Philip Guenther <guenther at gmail.com> with some additions and refinements by me. Positive test report from brad@ with many kde apps. fork(2) and pthread_atfork(3) pthread regresses pass. okay tedu@, kettenis@, marc@
* add -Wstrict-prototypes -Wmissing-prototypes -Wsign-comparemarc2006-01-051-2/+6
| | | | | | Minor tweaks to compile with the above, primarily in fixing the conflicts between semaphore.h and rthread.h "i like the additional warnings" tedu@
* Cleanup struct pthread and stack after thread exits. This version doesotto2006-01-041-2/+3
| | | | not use a separate reaper thread. ok tedu@ marc@
* thread stack handling changes. Add guard zones and allow stackmarc2006-01-011-2/+2
| | | | | | | | size (and guard zone size) to be set using pthread_attr. Guard zones are specified in bytes, but implemented in terms of a page size. OK Otto@