Subj : Re: Deadlock Calculator To : comp.programming.threads From : Uenal Mutlu Date : Sun May 15 2005 05:59 am "David Schwartz" wrote > "Uenal Mutlu" wrote > > > Here's an example showing the difference when recursive locking is used: > > > DATA: > > ObjectList: a b > > fRecursiveLocks: 0 > > Objects in T0: b a > > Objects in T1: b a a b > > ANALYSIS: > > SelfDeadlock: object 'a' in T1(ix=2) vs. T1(ix=1) > > Result: Deadlock! > > Whew. Good thing we saw the deadlock and caught the bug. > > > DATA: > > ObjectList: a b > > fRecursiveLocks: 1 > > Objects in T0: b a > > Objects in T1: b a a b > > ANALYSIS: > > Result: No deadlock > > Oops, now the bug slips into release and can bite customers. It has nothing to do with whether release or debug build. It just shows the effect of a locking method which permits a thread to lock the same object multiple times without blocking (ie. deadlocking) itself. Ie. calling Lock() for an object (here 'a') which is already locked by the same thread). Case 1 is a Lock() method without recursive locking capability, case 2 is with. .