|
Re: Owned Locks: msg#00005java.jsr.166-concurrency
Richard Zschech wrote: I previously posted a question [1] over a year and a half ago ... about This feels very much like another example of what I called GenderLock in an earlier posting, but have since learned is known as "room synchronization". See http://www-2.cs.cmu.edu/afs/cs/project/pscico/www/rooms.html for more, but the basic idea is that any number of threads can enter a room, and only one room at a time can be entered. That sounds a lot like having a lock that can have one owner at a time, but is not tied to one thread. https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/rrlock/RRLock.java (For "gender", read "room" in this code.) But Doug's suggestion of using ThreadLocals is interesting, because it leads to an entirely different implementation with very similar behavior: https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/rrlock/OwnedLock.java Caveat lector: I have done only primitive testing of this class; in particular, I haven't tried out the Condition support at all. Can you expand a bit on the two applications of owned locks that you mentioned, session ID and transaction ID? --tim
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: more lock modes based on AbstractQueuedSynchronizer, Tim Peierls |
|---|---|
| Next by Date: | Re: Owned Locks, Richard Zschech |
| Previous by Thread: | Owned Locks, Richard Zschech |
| Next by Thread: | Re: Owned Locks, Richard Zschech |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |