summaryrefslogtreecommitdiffstats
path: root/lib/libthr
Commit message (Collapse)AuthorAgeFilesLines
* In function pthread_condattr_getpshared, store result correctly.davidxu2008-08-011-1/+1
| | | | PR: kern/126128
* Enable GCC stack protection (aka Propolice) for userland:ru2008-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | - It is opt-out for now so as to give it maximum testing, but it may be turned opt-in for stable branches depending on the consensus. You can turn it off with WITHOUT_SSP. - WITHOUT_SSP was previously used to disable the build of GNU libssp. It is harmless to steal the knob as SSP symbols have been provided by libc for a long time, GNU libssp should not have been much used. - SSP is disabled in a few corners such as system bootstrap programs (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves. - It should be safe to use -fstack-protector-all to build world, however libc will be automatically downgraded to -fstack-protector because it breaks rtld otherwise. - This option is unavailable on ia64. Enable GCC stack protection (aka Propolice) for kernel: - It is opt-out for now so as to give it maximum testing. - Do not compile your kernel with -fstack-protector-all, it won't work. Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
* Add two commands to _umtx_op system call to allow a simple mutex to bedavidxu2008-06-243-54/+106
| | | | | | | | | | | | | | locked and unlocked completely in userland. by locking and unlocking mutex in userland, it reduces the total time a mutex is locked by a thread, in some application code, a mutex only protects a small piece of code, the code's execution time is less than a simple system call, if a lock contention happens, however in current implemenation, the lock holder has to extend its locking time and enter kernel to unlock it, the change avoids this disadvantage, it first sets mutex to free state and then enters kernel and wake one waiter up. This improves performance dramatically in some sysbench mutex tests. Tested by: kris Sounds great: jeff
* Make pthread_cleanup_push() and pthread_cleanup_pop() as a pair of macros,davidxu2008-06-093-22/+50
| | | | | | | use stack space to keep cleanup information, this eliminates overhead of calling malloc() and free() in thread library. Discussed on: thread@
* Call the fcntl compatiblity wrapper from the thread library fcntl wrappersdfr2008-05-301-1/+2
| | | | | | so that they get the benefit of the (limited) forward ABI compatibility. MFC after: 1 week
* Eliminate global mutex by using pthread_once's state field asdavidxu2008-05-301-33/+29
| | | | a semaphore.
* - Reduce function call overhead for uncontended case.davidxu2008-05-293-217/+104
| | | | | - Remove unused flags MUTEX_FLAGS_* and their code. - Check validity of the timeout parameter in mutex_self_lock().
* Commit missing mips libthr support that I thought I'd committed earlierimp2008-05-112-0/+141
|
* Remove libc_r's remnant code.davidxu2008-05-061-16/+0
|
* Use UMTX_OP_WAIT_UINT_PRIVATE and UMTX_OP_WAKE_PRIVATE to savedavidxu2008-04-299-19/+20
| | | | time in kernel(avoid VM lookup).
* Increase the default MUTEX_ADAPTIVE_SPINS to 2000, after furtherkris2008-04-261-1/+1
| | | | | | | | testing it turns out 200 was too short to give good adaptive performance. Reviewed by: jeff MFC after: 1 week
* Bring in mips threads support from perforce mips2-jnpr branch.imp2008-04-261-0/+5
|
* Avoid various shadowed variables. libthr is now almost WARNS=4 clean exceptdelphij2008-04-234-25/+25
| | | | | | for some const dequalifiers that needs more careful investigation. Ok'ed by: davidxu
* Use native rwlock.davidxu2008-04-221-54/+20
|
* _vfork is not in libthr, remove the reference.davidxu2008-04-161-1/+0
|
* don't include pthread_np.h, it is not used.davidxu2008-04-141-1/+0
|
* put THR_CRITICAL_LEAVE into do .. while statement.davidxu2008-04-031-2/+4
|
* add __hidden suffix to _umtx_op_err, this eliminates PLT.davidxu2008-04-031-1/+1
|
* Non-portable functions are in pthread_np.h, fix compiling problem.davidxu2008-04-021-1/+1
|
* Add pthread_setaffinity_np and pthread_getaffinity_np to libc namespace.davidxu2008-04-021-2/+0
|
* Remove unused functions.davidxu2008-04-022-55/+0
|
* Replace function _umtx_op with _umtx_op_err, the later function directlydavidxu2008-04-029-51/+112
| | | | | | returns errno, because errno can be mucked by user's signal handler and most of pthread api heavily depends on errno to be correct, this change should improve stability of the thread library.
* Replace userland rwlock with a pure kernel based rwlock, the newdavidxu2008-04-024-223/+199
| | | | | | implementation does not switch pointers when it resumes waiters. Asked by: jeff
* Restore normal pthread_cond_signal path to avoid some obscure races.davidxu2008-04-011-2/+3
|
* return EAGAIN early rather than running bunch of code later, micro optimizedavidxu2008-04-011-1/+3
| | | | static branch prediction.
* Rewrite rwlock to user atomic operations to change rwlock state, thisdavidxu2008-03-313-141/+281
| | | | | | | eliminates internal mutex lock contention when most rwlock operations are read. Orignal patch provided by: jeff
* Remove options MK_LIBKSE and DEFAULT_THREAD_LIB now that we no longerru2008-03-291-4/+1
| | | | build libkse. This should fix WITHOUT_LIBTHR builds as a side effect.
* Compile libthr with warnings.ru2008-03-253-6/+9
|
* Fixed mis-implementation of pthread_mutex_get{spin,yield}loops_np().ru2008-03-251-4/+7
| | | | Reviewed by: davidxu
* Add POSIX pthread API pthread_getcpuclockid() to get a thread's cpudavidxu2008-03-223-0/+50
| | | | time clock id.
* Resolve __error()'s PLT early so that it needs not to be resolved again,davidxu2008-03-211-0/+3
| | | | | otherwise rwlock is recursivly called when signal happens and the __error was never resolved before.
* pthread_mutexattr_destroy() was accidentally broken in last revision,ru2008-03-201-0/+1
| | | | unbreak it. We should really start compiling this with warnings.
* Preserve application code's errno in rtld locking code, it attemps to keepdavidxu2008-03-201-2/+31
| | | | any case safe.
* Make pthread_mutexattr_settype to return error number directly anddavidxu2008-03-201-3/+1
| | | | | | conformant to POSIX specification. Bug reported by: modelnine at modelnine dt org
* don't reduce new thread's refcount if current thread can not set cpusetdavidxu2008-03-191-1/+1
| | | | for it, since the new thread will reduce it by itself.
* - Trim trailing spaces.davidxu2008-03-191-8/+8
| | | | - Use a different sigmask variable name to avoid confusing.
* if passed thread pointer is equal to current thread, pass -1 to kerneldavidxu2008-03-191-11/+19
| | | | to speed up searching.
* - Copy signal mask out before THR_UNLOCK(), because THR_UNLOCK() may calldavidxu2008-03-183-4/+17
| | | | | | | | _thr_suspend_check() which messes sigmask saved in thread structure. - Don't suspend a thread has force_exit set. - In pthread_exit(), if there is a suspension flag set, wake up waiting- thread after setting PS_DEAD, this causes waiting-thread to break loop in suspend_common().
* Actually delete SIGCANCEL mask for suspended thread, so the signal will notdavidxu2008-03-161-3/+2
| | | | be masked when it is resumed.
* If a thread is cancelled, it may have already consumed a umtx_wake,davidxu2008-03-111-0/+2
| | | | check waiter and semphore counter to see if we may wake up next thread.
* Fix a bug when calculating remnant size.davidxu2008-03-061-1/+1
|
* Don't report death event to debugger if it is a forced exit.davidxu2008-03-061-1/+1
|
* Restore code setting new thread's scheduler parameters, I was thinkingdavidxu2008-03-061-15/+11
| | | | | | that there might be starvations, but because we have already locked the thread, the cpuset settings will always be done before the new thread does real-world work.
* Increase and decrease in_sigcancel_handler accordingly to avoid possibledavidxu2008-03-051-2/+2
| | | | error caused by nested SIGCANCEL stack, it is a bit complex.
* Use cpuset defined in pthread_attr for newly created thread, for now,davidxu2008-03-053-21/+57
| | | | | | | we set scheduling parameters and cpu binding fully in userland, and because default scheduling policy is SCHED_RR (time-sharing), we set default sched_inherit to PTHREAD_SCHED_INHERIT, this saves a system call.
* Add more cpu affinity function's symbols.davidxu2008-03-051-0/+6
|
* Check actual size of cpuset kernel is using and define underscore versiondavidxu2008-03-051-7/+42
| | | | of API.
* 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
|
OpenPOWER on IntegriCloud