
27 Mar
2014
27 Mar
'14
5 p.m.
On Thu, Mar 27, 2014 at 9:09 AM, Elad Moshe
If both threads tried to upgrade, you would have a deadlock.
But how is it possible? isn't the upgrade operation atomic? if the 2 threads try to upgrade, one will succeed and the other one will block until the first thread will unlock.
The problem is that upgrade implies that the read lock is not released before upgrading to the write lock. If both held read locks, and both tried to upgrade, this would lead to deadlock. Brian