summaryrefslogtreecommitdiff
path: root/lib/libpthread/sys/lock.c
Commit message (Collapse)AuthorAgeFilesLines
* Repo copy libpthreads to libkse.David E. O'Brien2007-10-091-351/+0
| | | | | | | | | This introduces the WITHOUT_LIBKSE nob, and changes WITHOUT_LIBPTHREADS to mean with neither threading libs. Approved by: re(kensmith) Notes: svn path=/head/; revision=172492
* Catch up with the atomic_FOO_ptr() changes and silence a few warnings.Daniel Eischen2005-07-291-7/+14
| | | | Notes: svn path=/head/; revision=148542
* Change the spin lock logic to a reasonable one. We should spin whenXin LI2005-02-271-1/+1
| | | | | | | | | | | | the lock is held by other thread, but not when nobody owns it. According to deischen@, this part of code will never be hit in our threads library, since it does not use locks without wait/wakeup functions. Spotted by: mingyanguo via ChinaUnix.net forum Reviewed by: deischen Notes: svn path=/head/; revision=142670
* Add the ability to reinitialize libpthread's internal FIFO-queueingDaniel Eischen2003-11-041-12/+51
| | | | | | | | | locks. Reviewed by: davidxu Notes: svn path=/head/; revision=122074
* Only generate code for _LCK_ASSERT if _LCK_DEBUG is defined.David Xu2003-10-021-1/+6
| | | | Notes: svn path=/head/; revision=120658
* Don't assume sizeof(long) = sizeof(int) on x86; use intDaniel Eischen2003-09-031-11/+11
| | | | | | | | | | | | | | | instead of long types for low-level locks. Add prototypes for some internal libc functions that are wrapped by the library as cancellation points. Add memory barriers to alpha atomic swap functions (submitted by davidxu). Requested by: bde Notes: svn path=/head/; revision=119723
* Change low-level locking a bit so that we can tell ifDaniel Eischen2003-05-241-21/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=115278
* Add a method of yielding the current thread with the schedulerDaniel Eischen2003-05-161-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | lock held (_thr_sched_switch_unlocked()) and use this to avoid dropping the scheduler lock and having the scheduler retake the same lock again. Add a better way of detecting if a low-level lock is in use. When switching out a thread due to blocking in the UTS, don't switch to the KSE's scheduler stack only to switch back to another thread. If possible switch to the new thread directly from the old thread and avoid the overhead of the extra context switch. Check for pending signals on a thread when entering the scheduler and add them to the threads signal frame. This includes some other minor signal fixes. Most of this was a joint effor between davidxu and myself. Reviewed by: davidxu Approved by: re@ (blanket for libpthread) Notes: svn path=/head/; revision=115080
* Protect against a race between granting a lock and accessingDaniel Eischen2003-05-041-7/+27
| | | | | | | | | other parts of the lock. Submitted by: davidxu Notes: svn path=/head/; revision=114680
* Sorry folks; I accidentally committed a patch from what I was workingDaniel Eischen2003-04-181-1/+1
| | | | | | | | | on a couple of days ago. This should be the most recent changes. Noticed by: davidxu Notes: svn path=/head/; revision=113661
* Add FIFO queueing locking operations based on atomic swap.Daniel Eischen2003-04-181-0/+268
Modify thread errno for the new libpthread changes. Reviewed by: davidxu Notes: svn path=/head/; revision=113657