summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_concurrency.c
Commit message (Collapse)AuthorAgeFilesLines
* Use a generic way to back threads out of wait queues when handlingdeischen2004-12-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | signals instead of having more intricate knowledge of thread state within signal handling. Simplify signal code because of above (by David Xu). Use macros for libpthread usage of pthread_cleanup_push() and pthread_cleanup_pop(). This removes some instances of malloc() and free() from the semaphore and pthread_once() implementations. When single threaded and forking(), make sure that the current thread's signal mask is inherited by the forked thread. Use private mutexes for libc and libpthread. Signals are deferred while threads hold private mutexes. This fix also breaks www/linuxpluginwrapper; a patch that fixes it is at http://people.freebsd.org/~deischen/kse/linuxpluginwrapper.diff Fix race condition in condition variables where handling a signal (pthread_kill() or kill()) may not see a wakeup (pthread_cond_signal() or pthread_cond_broadcast()). In collaboration with: davidxu
* Fixed a misspelling of 0 as NULL.bde2004-03-141-1/+1
|
* Allow the concurrency level to be reduced.deischen2003-08-301-28/+54
| | | | Reviewed by: davidxu
* Rethink the MD interfaces for libpthread to account fordeischen2003-08-051-1/+1
| | | | | | | | | archs that can (or are required to) have per-thread registers. Tested on i386, amd64; marcel is testing on ia64 and will have some follow-up commits. Reviewed by: davidxu
* sysctlbyname needs size_t type, not int.davidxu2003-07-311-1/+1
|
* o Eliminate upcall for PTHREAD_SYSTEM_SCOPE thread, now itdavidxu2003-07-171-1/+1
| | | | | | | | | | | | | is system bound thread and when it is blocked, no upcall is generated. o Add ability to libkse to allow it run in pure 1:1 threading mode, defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option. o Eliminate code for installing dummy signal handler for sigwait call. o Add hash table to find thread. Reviewed by: deischen
* Change low-level locking a bit so that we can tell ifdeischen2003-05-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | a lock is being waitied on. Fix a races in join and cancellation. When trying to wait on a CV and the library is not yet threaded, make it threaded so that waiting actually works. When trying to nanosleep() and we're not threaded, just call the system call nanosleep instead of adding the thread to the wait queue. Clean up adding/removing new threads to the "all threads queue", assigning them unique ids, and tracking how many active threads there are. Do it all when the thread is added to the scheduling queue instead of making pthread_create() know how to do it. Fix a race where a thread could be marked for signal delivery but it could be exited before we actually add the signal to it. Other minor cleanups and bug fixes. Submitted by: davidxu Approved by: re@ (blanket for libpthread)
* o Don't add a scope system thread's KSE to the list of availabledeischen2003-04-281-45/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KSEs when it's thread exits; allow the GC handler to do that. o Make spinlock/spinlock critical regions. The following were submitted by davidxu o Alow thr_switch() to take a null mailbox argument. o Better protect cancellation checks. o Don't set KSE specific data when creating new KSEs; rely on the first upcall of the KSE to set it. o Add the ability to set the maximum concurrency level and do this automatically. We should have a way to enable/disable this with some sort of tunable because some applications may not want this to be the default. o Hold the scheduling lock across thread switch calls. o If scheduling of a thread fails, make sure to remove it from the list of active threads. o Better protect accesses to a joining threads when the target thread is exited and detached. o Remove some macro definitions that are now provided by <sys/kse.h>. o Don't leave the library in threaded mode if creation of the initial KSE fails. o Wakeup idle KSEs when there are threads ready to run. o Maintain the number of threads active in the priority queue.
* Add a working pthread_[gs]etconcurrency. Initial null implementationdeischen2003-04-221-0/+120
provided by Sergey A. Osokin <osa@freebsd.org.ru>. In order to test this on a single CPU machine, you need to: sysctl kern.threads.debug=1 sysctl kern.threads.virtual_cpu=2
OpenPOWER on IntegriCloud