RE: [Algorithms] RE: simple threading control
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2003-12-12 18:20:30
|
> One thing that you are missing is tracking which thread > already has the lock, so that further locks on that same > thread always succeed. Otherwise, you'll deadlock against > your own thread. There's a not-insignificant contingent of system programmers who believe that recursive locks promote laziness, and that a design is better off if it doesn't need them. You could argue that if you are surprised by deadlocking on yourself, you don't understand your own design; you should design to be locking correct, and you shouldn't be doing enough with the lock held to have to worry about recursive locking. I'm not a convert myself, but I attend service now and then, because they're an interesting bunch to hang out with :-) Cheers, / h+ PS: "real" spin-locks, including clearing interrupts and not page-faulting while holding them, of course cannot be recursive on thread Id in any system. |