Greetings,

Attached are fixes for sync.rb, both the current stable version and
the version in the SVN trunk.

The fix to sync_try_lock is obvious and straight-forward, the fact
that no one noticed it earlier just goes to show how important it is
to pick meaningful variable names, and kind of proves that no one
really wanted to do deadlock-free two-level synchronization with
sync.rb before [0].

The change to Err.Fail was inspired by [1]. It's not necessary for
Ruby 1.9 version of sync.rb, but in 1.8, I can't see any reason why
you'd want to keep the thread locked when raising an exception that
may or may not be handled outside the class.

[0] http://cvs.savannah.gnu.org/viewcvs/samizdat/samizdat/lib/samizdat/cache.rb?rev=1.99

[1] http://rubyforge.org/pipermail/mongrel-users/2006-October/001752.html

-- 
Dmitry Borodaenko