| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
without atomics, a smaller list.
ok mpi@ visa@
|
| |
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
From Brad, tested by Miod, OK kettenis@
|
| |
|
|
| |
From Brad, OK mpi@ kettenis@
|
| |
|
|
|
| |
librthread on armv7 as well
from brad ok visa@ kettenis@ mpi@
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
| |
implementation is now spread between libc and librthread. No changes
to the content
ok mpi@
|
| |
|
|
|
|
|
|
| |
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@
|
| |
|
|
| |
OK mpi@, deraadt@
|
| |
|
|
| |
vmd(8)'s regression.
|
| |
|
|
| |
Reported by Gregor Best.
|
| |
|
|
| |
ok everybody
|
| |
|
|
| |
annoying strict prototypes
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
| |
references. Use _thread_pagesize for the semaphore mmap size instead of
calling getpagesize() each time.
ok beck@
|
| |
|
|
|
|
|
| |
with ld.so locking whenever building NOPIC
pointless use of __ELF__ noted by brad@
ok miod@
|
| | |
|
| |
|
|
| |
ok deraadt@
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
| |
gcc 3 as the compiler. The way constructors are built triggers this warning,
which is fatal because of -Werror. ok espie@ guenther@
|
| |
|
|
|
|
| |
Makes "make build" build with WARNINGS=Yes on amd64.
ok espie
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
| |
|
|
| |
ok guenther@
|
| |
|
|
|
|
|
|
|
|
|
| |
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@.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@.
|
| |
|
|
|
|
| |
it can be used for not-strictly-threading purposes
ok matthew@ kurt@
|
| |
|
|
| |
Add pthread_mutex_timedlock(), requested by dcoppa@
|
| |
|
|
| |
Ulmer). Only pull in bsd.lib.mk once to avoid linking objects twice
|
| | |
|
| | |
|
| |
|
|
| |
ok guenther@
|
| | |
|
| |
|
|
| |
to new files rthread_rwlock.c, rthread_rwlockattr.c, and rthread_once.c
|
| |
|
|
|
|
|
| |
new file rthread_mutexattr.c. Add basic implementations of
pthread_mutexattr_{set,get}{protocol,prioceiling}
Requested by aja
|
| |
|
|
|
|
| |
using previously allocated SIGTHR to interrupt in-process syscalls
and fixing the spelling of "cancelled" along the way.
Modeled on FreeBSD's libthr
|
| |
|
|
| |
of support in ld.so
|
| |
|
|
| |
Requested by many to ease substitution of librthread for libpthread
|
| |
|
|
|
| |
errno. The ASM bits for _cerror are sketchy or missing for some archs
but that can be corrected in-tree.
|
| |
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
| |
ok kurt@
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
- 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@
|
| |
|
|
|
|
| |
Minor tweaks to compile with the above, primarily in fixing
the conflicts between semaphore.h and rthread.h
"i like the additional warnings" tedu@
|
| |
|
|
| |
not use a separate reaper thread. ok tedu@ marc@
|
| |
|
|
|
|
|
|
| |
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@
|