summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add pthread spinlock support.pirofti2012-05-031-1/+6
| | | | | | | | | | | 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/+13
| | | | | | | | | | | | | | | 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@.
* Remove pthread_suspend* and related functions. This is part of thekurt2012-03-221-2/+1
| | | | rthreads major library bump from last night. okay kettenis@
* Add sem_timewait() and fix sem_wait()'s handling of signals, soguenther2012-03-031-2/+2
| | | | | | | 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.
* Add pthread_condattr_{get,set}clock(), requested by aja@guenther2012-02-231-2/+3
| | | | Add pthread_mutex_timedlock(), requested by dcoppa@
* Fix previous commit: _rthread_init() was static.guenther2012-02-181-1/+2
| | | | Improve consistency of error naming
* Fix the handling of the stackaddr, stacksize, and guardsize attributes:guenther2012-02-181-6/+12
| | | | | | | | | | | 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@
* Add pthread_rwlockattr_{get,set}pshared() andguenther2012-02-151-2/+2
| | | | | | pthread_mutexattr_{get,set}kind_np() tweaked diff from brad
* Reimplement mutexes, condvars, and rwlocks to eliminate bugs,guenther2012-01-171-19/+34
| | | | | | | | | | | | | 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.
* Split out the pthread_mutexattr_* functions from rthread_sync.c toguenther2011-12-211-2/+5
| | | | | | | 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/+9
| | | | | | using previously allocated SIGTHR to interrupt in-process syscalls and fixing the spelling of "cancelled" along the way. Modeled on FreeBSD's libthr
* Copy support for sched_get_priority_{min,max} from libpthread.guenther2011-11-061-1/+4
| | | | Requested by many to ease substitution of librthread for libpthread
* Move <machine/spinlock.h> into rthread.h; strip out unnecessary #includesguenther2011-11-061-1/+2
|
* Use __tfork, __get_tcb, and __set_tcb to have a real TCB and per-threadguenther2011-10-171-1/+6
| | | | | errno. The ASM bits for _cerror are sketchy or missing for some archs but that can be corrected in-tree.
* Convert thrsleep() to an absolute timeout with clockid to eliminate aguenther2009-11-271-4/+5
| | | | | | race condition and prep for later support of pthread_condattr_setclock() "get it in" deraadt@, tedu@, cheers by others
* Convert thrsigdivert to (almost) be sigtimedwait by adding siginfo_tguenther2009-11-271-2/+2
| | | | | | | and struct timespec * argument. sigtimedwait is just a one line wrapper after this. "get it in" deraadt@, tedu@, cheers by others
* Change threxit() to take a pointer to a pid_t to zero out from theguenther2009-11-271-6/+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-1/+4
| | | | ok kurt@
* Increase default thread stack size to 256K on 32bit archs and 512K onkurt2009-04-211-2/+6
| | | | | 64bit archs to accommodate the growing number of ports that put large buffers on the stack. Supported by many with no objections.
* thrsigdivert() takes a sigset_t, not a pointer to one. Detected byguenther2009-02-201-2/+2
| | | | | | finally reading the lint warnings (sigh) ok tedu@
* Make sigwait() work correctly. In particular, it'll work when theguenther2008-10-031-2/+1
| | | | | | | | | | | | | signal is already pending in the calling thread or the main thread and there's no longer a race condition where the signal could be diverted but sigwait() would still block. There were some off-by-one errors too. (The checking of the main thread's pending list is just until a pending list for the process can be added to struct process. For now, such signals end up as pending on the main thread.) oks tedu@ and art@
* - Add fork/vfork wrapper functions to reset state in the child process.kurt2008-06-051-1/+6
| | | | | | | | | | | - 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-7/+9
| | | | | | 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-1/+6
| | | | not use a separate reaper thread. ok tedu@ marc@
* thread stack handling changes. Add guard zones and allow stackmarc2006-01-011-1/+10
| | | | | | | | 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@
* Add "print debug foo" function safe to use in signal handlers, example:marc2005-12-311-1/+3
| | | | | | | | | _rthread_debug(3, "foo = %s", foo); where output is to stderr and will only be printed if the current debug level is >= 3. Messages with a debug level of 0 are always printed. The level can be set from the environment (not enabled yet) or with gdb by modifying variable _rthread_debug_level. "Fine with me" -Otto
* Implement suspend/resume and creation of initially suspended threads.otto2005-12-311-1/+4
| | | | | With this, java seems to be operational. Also make threads_ready non-static, which is needed for an upcoming diff. ok tedu@
* use queue.h macros for thread house keeping; make some vars non-staticotto2005-12-301-2/+8
| | | | and fix a bug in thread creation error path. ok tedu@
* prototype all the thread syscalls in rthread.h for now.tedu2005-12-301-1/+9
| | | | update for new thrwakeup that takes a count argument
* more consistently use _rthread prefix for all not meant to be exportedtedu2005-12-221-2/+2
| | | | interfaces that aren't static, and a few that are but which will change
* Fix hppa ldcw alignment issue.marco2005-12-191-4/+9
| | | | | Help deraadt, tedu, kettenis Ok tedu, kettenis
* update copyright to 2005tedu2005-12-191-2/+2
|
* add pthread_get/set_concurrency (useless for now)tedu2005-12-191-1/+2
| | | | add pthread_get/set_stack[addr] (info not used yet)
* add pthread_cleanup_push and pthread_cleanup_poptedu2005-12-141-1/+8
|
* add bits for pthread_cancel. we don't really have cancellation points yettedu2005-12-141-4/+7
| | | | but some of the functions are here now.
* change keys to use table instead of list, makes a sane destructor implementationtedu2005-12-141-3/+4
| | | | possible
* make the mutex unlock and sleep in pthread_cond_wait properly atomictedu2005-12-131-1/+2
|
* correct implementation of pthread_cond_signal. it doesn't raise the semtedu2005-12-131-1/+2
| | | | value if there are no waiters.
* add userland thread library. incomplete, but functionaltedu2005-12-031-0/+111