Subj : Re: Deadlock theorem To : comp.programming.threads From : David Schwartz Date : Wed May 04 2005 05:04 am "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:d59mgm$8k8$02$1@news.t-online.com... >> > Locker L(o1.LV); >> > while (!IsEnd()) >> > { >> > o1.DoStuff(); >> > } >> This won't work. If 'IsEnd' acquires and releases a lock, then your >> rules are violated since 'IsEnd' is in the same block as 'DoStuff'. If >> 'IsEnd' does not acquire any locks, then it can never return a different >> value because no lock is released to allow another thread to change the >> return value. > > Ok, the new rule d should have covered this now. Nope, this code is still illegal by your current rules. There are two possibilities: 1) IsEnd acquires and releases a lock. In this case, your rule 'd' is violated. 2) IsEnd acquires no locks. In this case, the code is unsafe and can never ensure 'IsEnd' returns the right value. In most cases, 'IsEnd' will have to acquire a lock of some kind. This violates rule 'd' of your hierarchy. DS .