On sychronized(lock1, lock2, ...)
Ali Çehreli
acehreli at yahoo.com
Thu Aug 11 05:13:45 UTC 2022
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
More information about the Digitalmars-d
mailing list