|
Re: more lock modes based on AbstractQueuedSynchronizer: msg#00004java.jsr.166-concurrency
Hu, Jinsong wrote: I am new to jdk1.5 concurrent API, at the first glance of AbstractQueuedSynchronizer, it appears to me that this class has built-in support for Exclusive and Shared mode locks, if I want to support more type of locks, such as, IX, SIX, Update locks, which are common to database systems, can I still base on this framework, or I have to implement something similar from scratch? and Matthias Ernst wrote: * the lock state must be encodable in an int Here, for example, is an implementation of a four-mode (read, write, intent-read, and intent-write) lock. https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/rrlock/MMLock.java I haven't done significant testing of this, so there are undoubtedly bugs, but this should give you an idea of what is possible and how to approach it. You can also use this as a three-mode (read, write, and increment) lock. The incrementLock() method is an alias for intentWriteLock(). I wrote this as part of a quad-tree implementation to demonstrate intent locking. I'll post a link to it when it exists. --tim
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Owned Locks, Richard Zschech |
|---|---|
| Next by Date: | Re: Owned Locks, Tim Peierls |
| Previous by Thread: | more lock modes based on AbstractQueuedSynchronizer, Hu, Jinsong |
| Next by Thread: | AW: more lock modes based on AbstractQueuedSynchronizer, Ernst, Matthias |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |