POV-Ray : Newsgroups : povray.off-topic : Locking references : Re: Locking references Server Time
8 Oct 2024 18:33:35 EDT (-0400)
  Re: Locking references  
From: clipka
Date: 9 Nov 2009 12:45:55
Message: <4af85553$1@news.povray.org>
Darren New schrieb:
> 
> 1) Lock things in order, as you say.
> 2) Don't hold a lock while waiting for another lock.
>    I.e., immediately roll back if you can't immediately aquire a lock.
> 3) Aquire all locks you'll need before you start processing.
>    E.g., "run this job where there's a video tape reader, a CD burner,
>    and a DSP available."
> 4) Only lock one thing, obviously.
> 5) Hmmmm... It's taking me too long to remember. :-)
> 
> But yeah, there's a formal mathematical proof that you can avoid 
> deadlock in exactly five ways.

I guess timing out on acquiring a lock would constitute a variant of 2) 
in theory, right?

Also note that 3) only works to prevent deadlocks if acquiring multiple 
locks at once is an atomic operation.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.