summaryrefslogtreecommitdiff
path: root/lib/librthread
AgeCommit message (Collapse)Author
2012-03-20Clean up unnecessary prototypes. Pointed out by brad@Philip Guenthe
2012-03-20Permit recursive locking in _rthread_dl_lock(), as an so's destructorPhilip Guenthe
may need to call dlclose(). problem observed by Antti Harri (iku at openbsd.fi), ok kurt@
2012-03-14Force sched_yield() to be resolved before calling dlctl(DL_SET*LCK) withPhilip Guenthe
a function that can call sched_yield(), to avoid recursion ok kurt@ kettenis@
2012-03-13Don't trust the environment if issetugid()Philip Guenthe
2012-03-03Sync the assembly statements with <machine/lock.h> for consistency.Miod Vallat
2012-03-03Bump minor for recent additionsPhilip Guenthe
2012-03-03sem_timedwait() should return ETIMEDOUT instead of EWOULDBLOCK on timeoutPhilip Guenthe
2012-03-03Add sem_timewait() and fix sem_wait()'s handling of signals, soPhilip Guenthe
that it resumes waiting unless the thread was canceled. As part of this, change the internal _sem_wait() function to return zero on success and an errno value on failure instead of 1 on success and zero on failure.
2012-03-02fix check when setting the contention scope. harmless atm but still wrong.Federico G. Schwindt
guenther@ ok.
2012-03-02for readability, put the label on it's own line.Federico G. Schwindt
2012-03-02_SPINLOCK_UNLOCKED isn't zero everywhere (*cough*hppa*cough*), soPhilip Guenthe
sem_init() can't assume that calloc will leave the embedded spinlock in the unlocked state ok miod@ otto@
2012-02-28Our default mutex type is PTHREAD_MUTEX_ERRORCHECK, for which tryingPhilip Guenthe
to unlock an uninitialized mutex is required to return EPERM, so add the necessary checks. For recursive mutexes, return an error from pthread_mutex_lock() if the count would overflow. problem observed in glib testing by aja@
2012-02-27fix __errno symbol nameMiod Vallat
2012-02-26Fix buglets.Miod Vallat
2012-02-26__cerror gets invoked with errno in v0, not a0.Miod Vallat
2012-02-26Fix label for threaded binaries to link.Miod Vallat
2012-02-24sched_yield() is the standard name while pthread_yield() is thePhilip Guenthe
non-standard alias, so prefer the former
2012-02-23PTHREAD_MUTEX_NORMAL mutexes are supposed to self-deadlock, not abort.Philip Guenthe
That deadlock can be exited via a timeout for pthread_mutex_timedlock(). Unwind all the state when pthread_mutex_timedlock() times out
2012-02-23Add pthread_condattr_{get,set}clock(), requested by aja@Philip Guenthe
Add pthread_mutex_timedlock(), requested by dcoppa@
2012-02-21Make pthread_suspend_np() and pthread_resume_np() simply fail insteadPhilip Guenthe
of doing the Wrong Thing.
2012-02-19Fix problems revealed by regress/lib/libpthread/stack/stack.cPhilip Guenthe
2012-02-19Use 'base' as an intermediate char* variable to avoid void* arithmeticPhilip Guenthe
2012-02-19Extend miod's fix CFLAGS fix to all gcc2 platforms (suggested by TobiasPhilip Guenthe
Ulmer). Only pull in bsd.lib.mk once to avoid linking objects twice
2012-02-19Use a form of designated initializer that works with gcc2Philip Guenthe
lint doesn't understand designated initializers, so hide them from it
2012-02-19Validate in pthread_attr_set{scope,sched{param,policy},inheritsched}()Philip Guenthe
the requested new value
2012-02-18Fix previous commit: _rthread_init() was static.Philip Guenthe
Improve consistency of error naming
2012-02-18Before using _thread_pagesize, make sure _rthread_init() has been calledPhilip Guenthe
2012-02-18id tag.Federico G. Schwindt
2012-02-18Fix the handling of the stackaddr, stacksize, and guardsize attributes:Philip Guenthe
don't try to merge values, round the sizes separately, and don't try to unmap application-supplied stacks. Copy from uthread the caching of default-sized stacks. Have pthread_attr_init() and pthread_create() get the default attributes from staticly allocated pthread_attr_t. Cache the pagesize in _rthread_init() and provide a macro for rounding to it based on suggestions from kettenis@ and tedu@, ok kettenis@
2012-02-18Missing cerror bits.Miod Vallat
2012-02-18Work around compiler confusion while building rthread.o on vax.Miod Vallat
2012-02-18Initialize the scope, policy, and inherit members in pthread_attr_init()Philip Guenthe
so that their pthread_attr_get* don't return bogus values. issue noted and tested by aja@
2012-02-17Allow librthread to build on mips64.Miod Vallat
2012-02-16Set __isthreaded in pthread_create() instead of _rthread_init() such that itMark Kettenis
properly represents whether a process is multi-threaded or not. This fixes a bug where if a forked child would create a new thread we would not set __isthreaded. ok guenther@
2012-02-15Nothing important, just switching from pthreads to rthreadsPhilip Guenthe
2012-02-15Bump major to be current libpthread major +1, so we can switch over cleanly.Philip Guenthe
If we have to revert to user-space threads, we'll do another major bump of libpthread going back
2012-02-15Add pthread_rwlockattr_{get,set}pshared() andPhilip Guenthe
pthread_mutexattr_{get,set}kind_np() tweaked diff from brad
2012-01-25@($*& Merging patches resulted in a line being duplicated instead ofPhilip Guenthe
moved. Unlocking a spinlock twice is bad, mmkay?
2012-01-17Reimplement mutexes, condvars, and rwlocks to eliminate bugs,Philip Guenthe
particularly the "consume the signal you just sent" hang, and putting the wait queues in userspace. Do cancellation handling in pthread_cond_*wait(), pthread_join(), and sem_wait(). Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add 'abort" argument to thrsleep to close cancellation race; make thr{sleep,wakeup} return errno values via *retval to avoid touching userspace errno.
2012-01-04Fix $OpenBSD tagPhilip Guenthe
2012-01-04Add some sanity checks, set errno accordingly to POSIX and add the namedMartin Pieuchot
semaphore stubs already provided by libpthread. We may move them in their own file in the future when we figure out a real implementation. Discussed with and looks ok to guenther@
2012-01-04Split out the semaphore functions.Martin Pieuchot
ok guenther@
2012-01-04Delete some parameter names and extra semicolons that slipped throughPhilip Guenthe
2011-12-28pthread_self() may be much cheaper and never more expensive than getthrid()Philip Guenthe
so prefer it for identifying the current thread
2011-12-27Don't let applications block, wait for, or handle SIGTHR, as thePhilip Guenthe
thread library uses it internally for cancellation.
2011-12-27On failure, pthread_kill() should return the errno, not -1Philip Guenthe
2011-12-24formatting errors, found using freebsd's "igor";Jason McIntyre
2011-12-22Add pthread_mutex_{get,set}prioceiling()Philip Guenthe
2011-12-21Split out the pthread_rwlock* and pthread_once() functions from rthread_sync.cPhilip Guenthe
to new files rthread_rwlock.c, rthread_rwlockattr.c, and rthread_once.c
2011-12-21Split out the pthread_mutexattr_* functions from rthread_sync.c toPhilip Guenthe
new file rthread_mutexattr.c. Add basic implementations of pthread_mutexattr_{set,get}{protocol,prioceiling} Requested by aja