summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_rwlock.c
Commit message (Collapse)AuthorAgeFilesLines
* don't include pthread_np.h, it is not used.davidxu2008-04-141-1/+0
|
* Replace userland rwlock with a pure kernel based rwlock, the newdavidxu2008-04-021-217/+93
| | | | | | 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-311-140/+223
| | | | | | | eliminates internal mutex lock contention when most rwlock operations are read. Orignal patch provided by: jeff
* Remove multiple _get_curthread() calls.davidxu2006-04-231-4/+1
|
* WARNS level 4 cleanup.davidxu2006-04-041-1/+1
|
* Import my recent 1:1 threading working. some features improved includes:davidxu2005-04-021-316/+263
| | | | | | | | | | | | | | | | 1. fast simple type mutex. 2. __thread tls works. 3. asynchronous cancellation works ( using signal ). 4. thread synchronization is fully based on umtx, mainly, condition variable and other synchronization objects were rewritten by using umtx directly. those objects can be shared between processes via shared memory, it has to change ABI which does not happen yet. 5. default stack size is increased to 1M on 32 bits platform, 2M for 64 bits platform. As the result, some mysql super-smack benchmarks show performance is improved massivly. Okayed by: jeff, mtm, rwatson, scottl
* o Assertions to catch that stuff that shouldn't happen is not happening.mtm2004-07-301-20/+16
| | | | | | | | | | o In the rwlock code: move a duplicated check inside an if..else to after the if...else clause. o When initializing a static rwlock move the initialization check inside the lock. o In thr_setschedparam.c: When breaking out of the trylock...retry if busy loop make sure to reset the mtx pointer to null if the mutex is nolonger in a queue.
* There are consumers of rwlocks, inluding our own libc, that depend onmtm2004-02-181-96/+24
| | | | | | | | | | a PTHREAD_RWLOCK_INITIALIZER to do for rwlocks what a similarly named symbol does for statically initialized mutexes. This symbol was dropped in The Open Group Base Specifications Issue 6 and does not exist in IEEE Std 1003.1, 2003, but it should still be supported for backwards compatibility. Pointy hat: mtm
* I update the rwlock code in libthr to be more standards compliant andmtm2004-01-291-12/+119
| | | | | | | | | | what do I get for my troubles? libc breaks offcourse! Reimplement a hack (in libthr) that allows libc to use rwlocks without initializing them first. The hack was reimplemented so that only a private libc version of the rwlock locking functions initializes an uninitialized rwlock. The application version will correctly fail.
* Implement reference counting of read-write locks. This usesmtm2004-01-191-8/+133
| | | | | | | | | | | | | | | | | a list in the thread structure to keep track of the locks and how many times they have been locked. This list is checked on every lock and unlock. The traversal through the list is O(n). Most applications don't hold so many locks at once that this will become a problem. However, if it does become a problem it might be a good idea to review this once libthr is off probation and in the optimization cycle. This fixes: o deadlock when a thread tries to recursively acquire a read lock when a writer is waiting on the lock. o a thread could previously successfully unlock a lock it did not own o deadlock when a thread tries to acquire a write lock on a lock it already owns for reading or writing [ this is admittedly not required by POSIX, but is nice to have ]
* Add an implementation of pthread_rwlock_timed{rd,wr}lock() to libthr withmtm2004-01-161-11/+54
| | | | attendant documentation.
* o We are not required to initialize an invalid rwlock. So axe all thatmtm2004-01-161-160/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | code and simply return EINVAL (which is allowed by the standard) in all those pthread functions that previously initialized it. o Refactor the pthread_rwlock_[try]rdlock() and pthread_rwlock_[try]wrlock() functions. They are now completeley condensed into rwlock_rdlock_common() and rwlock_wrlock_common(), respectively. o If the application tries to destroy an rwlock that is currently held by a thread return EBUSY where it previously went ahead and freed all resources associated with the lock. o Refactor _pthread_rwlock_init() to make it look (relatively) sane. o When obtaining a read lock on an rwlock the check for whether it would exceed the maximum allowed read locks should happen *before* we obtain the lock. o The pthread_rwlock_* functions shall *never* return EINTR, so make sure to requeue/resuspend the thread if it encounters such an error. o Make a note that pthread_rwlock_unlock() needs to ensure it holds a lock on an rwlock it tries to unlock. It will be implemented in a separate commit because it requires some additional rwlock infrastructure.
* - Add libthr but don't hook it up to the regular build yet. This is anjeff2003-04-011-0/+341
adaptation of libc_r for the thr system call interface. This is beta quality code.
OpenPOWER on IntegriCloud