summaryrefslogtreecommitdiffstats
path: root/lib/libthr
Commit message (Collapse)AuthorAgeFilesLines
...
* If a new thread is created, it inherits current thread's signal masks,davidxu2008-03-043-1/+24
| | | | | | | | however if current thread is executing cancellation handler, signal SIGCANCEL may have already been blocked, this is unexpected, unblock the signal in new thread if this happens. MFC after: 1 week
* Include cpuset.h, unbreak compiling.davidxu2008-03-041-0/+2
|
* implement pthread_attr_getaffinity_np and pthread_attr_setaffinity_np.davidxu2008-03-044-3/+68
|
* Implement functions pthread_getaffinity_np and pthread_setaffinity_np todavidxu2008-03-033-1/+78
| | | | get and set thread's cpu affinity mask.
* _pthread_mutex_isowned_np(): use a more reliable method; the current codedes2008-02-141-1/+1
| | | | | | will work in simple cases, but may fail in more complicated ones. Reviewed by: davidxu
* style.Makefile(5)obrien2008-02-136-6/+6
|
* style(9)obrien2008-02-132-6/+6
|
* Yet another pointy hat: when I zapped FBSDprivate_1.1, I forgot to movedes2008-02-061-0/+1
| | | | its contents to FBSDprivate_1.0.
* Remove unnecessary prototype.des2008-02-061-1/+0
|
* Convert pthread.map to the format expected by version_gen.awk, and modifydes2008-02-062-11/+3
| | | | | | the Makefile accordingly; libthr now explicitly uses libc's Versions.def. MFC after: 2 weeks
* Remove incorrectly added FBSDprivate_1.1 namespace, and move symbols whichdes2008-02-061-12/+4
| | | | are new in FreeBSD 8 to the appropriate namespace.
* Per discussion on -threads, rename _islocked_np() to _isowned_np().des2008-02-062-5/+5
|
* After careful consideration (and a brief discussion with attilio@), changedes2008-02-041-1/+1
| | | | | | | | | the semantics of pthread_mutex_islocked_np() to return true if and only if the mutex is held by the current thread. Obviously, change the regression test to match. MFC after: 2 weeks
* Add pthread_mutex_islocked_np(), a cheap way to verify that a mutex isdes2008-02-032-0/+31
| | | | | | | locked. This is intended primarily to support the userland equivalent of the various *_ASSERT_LOCKED() macros we have in the kernel. MFC after: 2 weeks
* SYSTEM_SCOPE_ONLY flag is no longer needed, it is the only mode libthrdavidxu2008-01-181-2/+0
| | | | supports.
* sem_post() requires to return -1 on error.davidxu2008-01-071-2/+2
|
* call underscore version of pthread_cleanup_pop instead.davidxu2007-12-201-1/+1
|
* Remove vfork() overloading, it is no longer needed.davidxu2007-12-202-11/+0
|
* Add function prototypes.davidxu2007-12-171-1/+7
|
* 1. Add function pthread_mutex_setspinloops_np to turn a mutex's spindavidxu2007-12-143-29/+114
| | | | | | | | loop count. 2. Add function pthread_mutex_setyieldloops_np to turn a mutex's yield loop count. 3. Make environment variables PTHREAD_SPINLOOPS and PTHREAD_YIELDLOOPS to be only used for turnning PTHREAD_MUTEX_ADAPTIVE_NP mutex.
* Enclose all code for macro ENQUEUE_MUTEX in do while statement, anddavidxu2007-12-111-5/+7
| | | | | | add missing brackets. MFC: after 1 day
* Fix pointer dereferencing problems in _pthread_mutex_init_calloc_cb() thatjasone2007-11-281-7/+3
| | | | were obscured by pseudo-opaque pthreads API pointer casting.
* Add _pthread_mutex_init_calloc_cb() to libthr and libkse, so that malloc(3)jasone2007-11-272-6/+28
| | | | | (part of libc) can use pthreads mutexes without causing infinite recursion during initialization.
* Simplify code, fix a thread cancellation bug in sem_wait and sem_timedwait.davidxu2007-11-231-21/+15
|
* Reuse nwaiter member field to record number of waiters, in sem_post(),davidxu2007-11-211-7/+31
| | | | | this should reduce the chance having to do a syscall when there is no waiter in the semaphore.
* Remove warning level and aliasing restrictions.davidxu2007-11-211-2/+0
|
* Convert ceiling type to unsigned integer before comparing, fix compilerdavidxu2007-11-211-3/+3
| | | | warnings.
* Add some function prototypes.davidxu2007-11-211-0/+5
|
* Remove umtx_t definition, use type long directly, add wrapper functiondavidxu2007-11-217-18/+31
| | | | | _thr_umtx_wait_uint() for umtx operation UMTX_OP_WAIT_UINT, use the function in semaphore operations, this fixed compiler warnings.
* These are the things that the tinderbox has problems with because itjb2007-11-201-0/+1
| | | | | | | | doesn't use the default CFLAGS which contain -fno-strict-aliasing. Until the code is cleaned up, just add -fno-strict-aliasing to the CFLAGS of these for the tinderboxes' sake, allowing the rest of the tree to have -Werror enabled again.
* In _pthread_key_create() ensure that libthr is initialized. Thismarius2007-11-061-1/+5
| | | | | | | | | | | fixes a NULL-dereference of curthread when libstdc+ initializes the exception handling globals on archs we can't use GNU TLS due to lack of support in binutils 2.15 (i.e. arm and sparc64), yet, thus making threaded C++ programs compiled with GCC 4.2.1 work again on these archs. Reviewed by: davidxu MFC after: 3 days
* Avoid doing adaptive spinning for priority protected mutex, currentdavidxu2007-10-311-2/+5
| | | | implementation always does lock in kernel.
* Don't do adaptive spinning if it is running on UP kernel.davidxu2007-10-311-3/+5
|
* Restore revision 1.55, the kris's adaptive mutex type.davidxu2007-10-311-14/+36
|
* Adaptive mutexes should have the same deadlock detection properties thatkris2007-10-301-0/+1
| | | | | | default (errorcheck) mutexes do. Noticed by: davidxu
* Add my recent work of adaptive spin mutex code. Use two environments variabledavidxu2007-10-303-47/+50
| | | | | | | | | | | | | | | | | | | | | | | | | to tune pthread mutex performance: 1. LIBPTHREAD_SPINLOOPS If a pthread mutex is being locked by another thread, this environment variable sets total number of spin loops before the current thread sleeps in kernel, this saves a syscall overhead if the mutex will be unlocked very soon (well written application code). 2. LIBPTHREAD_YIELDLOOPS If a pthread mutex is being locked by other threads, this environment variable sets total number of sched_yield() loops before the currrent thread sleeps in kernel. if a pthread mutex is locked, the current thread gives up cpu, but will not sleep in kernel, this means, current thread does not set contention bit in mutex, but let lock owner to run again if the owner is on kernel's run queue, and when lock owner unlocks the mutex, it does not need to enter kernel and do lots of work to resume mutex waiters, in some cases, this saves lots of syscall overheads for mutex owner. In my practice, sometimes LIBPTHREAD_YIELDLOOPS can massively improve performance than LIBPTHREAD_SPINLOOPS, this depends on application. These two environments are global to all pthread mutex, there is no interface to set them for each pthread mutex, the default values are zero, this means spinning is turned off by default.
* Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. Thiskris2007-10-291-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is also implemented in glibc and is used by a number of existing applications (mysql, firefox, etc). This mutex type is a default mutex with the additional property that it spins briefly when attempting to acquire a contested lock, doing trylock operations in userland before entering the kernel to block if eventually unsuccessful. The expectation is that applications requesting this mutex type know that the mutex is likely to be only held for very brief periods, so it is faster to spin in userland and probably succeed in acquiring the mutex, than to enter the kernel and sleep, only to be woken up almost immediately. This can help significantly in certain cases when pthread mutexes are heavily contended and held for brief durations (such as mysql). Spin up to 200 times before entering the kernel, which represents only a few us on modern CPUs. No performance degradation was observed with this value and it is sufficient to avoid a large performance drop in mysql performance in the heavily contended pthread mutex case. The libkse implementation is a NOP. Reviewed by: jeff MFC after: 3 days
* - Stop calling libthr alternative as it's now the defaultru2007-10-221-15/+7
| | | | | | | | | | | | | | threading library. - Now that libpthread is a symlink, it's no longer possible to link applications with libpthread and have libmap.conf(5) select the desired threading library; applications will be linked to the default threading library, libkse or libthr. Remove an obsolete paragraph. - Mention that improvements can be seen compared to libkse. Reviewed by: deischen, davidxu
* Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.davidxu2007-10-161-2/+4
|
* Reverse the logic of UP and SMP.davidxu2007-10-161-1/+1
| | | | Submitted by: jasone
* Tweak the handling of "WITHOUT_LIBPTHREAD". Also remove the accidentalobrien2007-10-091-2/+2
| | | | | | | treatment of 'LIBKSE' as an "old style" knob. Submitted by: ru Approved by: re(kensmith)
* Always install libpthread.* symlinks if at least one ofru2007-10-011-2/+3
| | | | | | | | | | | | the threading libraries is built. This simplifies the logic in makefiles that need to check if the pthreads support is present. It also fixes a bug where we would build a threading library that we shouldn't have built: for example, building with WITHOUT_LIBTHR and the default value of DEFAULT_THREADING_LIB (libthr) would mistakenly build the libthr library, but not install it. Approved by: re (kensmith)
* Output error message to STDERR_FILENO.davidxu2007-08-071-1/+1
| | | | Approved by: re (bmah)
* Set warning level to 2.davidxu2007-06-081-1/+2
|
* Bump library versions in preparation for 7.0.deischen2007-05-211-1/+1
| | | | Ok'd by: kan
* Fix a logic bug I re-introduced in my patch I sent to Danielru2007-05-181-1/+1
| | | | | | | that would cause the selected shared threading library to be overwritten with its 32-bit version on amd64. PR: amd64/112509
* Allow DEFAULT_THREAD_LIB to be set from /etc/src.conf.deischen2007-05-171-4/+4
| | | | Submitted by: ru
* Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.deischen2007-05-132-380/+6
| | | | | | | | | | Warning, after symbol versioning is enabled, going back is not easy (use WITHOUT_SYMVER at your own risk). Change the default thread library to libthr. There most likely still needs to be a version bump for at least the thread libraries. If necessary, this will happen later.
* backout experimental adaptive spinning mutex for product use.davidxu2007-05-093-9/+0
|
* Use C comments since we now preprocess these files with CPP.deischen2007-04-291-11/+14
|
OpenPOWER on IntegriCloud