This is a "feature" mentioned in Ali's book, with the note that it isn't currently supported. Is there any chance of this being implemented along the model of if deadlock, give all locks to the thread with the lowest Tid until unlock, then pass the lock to the thread with the next-highest Tid, and so on and so forth.
August 11, 2022 On sychronized(lock1, lock2, ...) | ||||
---|---|---|---|---|
| ||||
August 10, 2022 Re: On sychronized(lock1, lock2, ...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On 8/10/22 19:18, Ruby The Roobster wrote: > give all locks to the thread with the > lowest Tid until unlock, then pass the lock to the thread with the > next-highest Tid, and so on and so forth. I thought, as long as all threads use the same order when locking, there would be no deadlock (at least for this critical section). The locks can be sorted by their memory addresses. But I can see how that can fail if one of the "later" locks is already locked by one of the threads. I am not an expert on this; trying to learn... Ali |
Copyright © 1999-2021 by the D Language Foundation