Patches: Browse | Submit New | Admin

[#11680] Sync#try_lock always fails due to wrong variable name

Date:
2007-06-19 11:13
Priority:
3
Submitted By:
Dmitry Borodaenko (angdraug)
Assigned To:
Akinori MUSHA (knu)
Category:
Threads / Synchronization
State:
Open
Summary:
Sync#try_lock always fails due to wrong variable name

Detailed description
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

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-12-19 11:01
Sender: Roger Pack

Thanks for doing that
Date: 2008-12-15 09:20
Sender: Dmitry Borodaenko

Submitted to redmin.ruby-lang.org as #882:
http://redmine.ruby-lang.org/issues/show/882
Date: 2008-12-11 14:58
Sender: Roger Pack

feel free to submit a patch to the new bug tracker
[http://redmine.ruby-lang.org/] if this patch still applies.
Thanks!
Date: 2008-02-04 20:34
Sender: Dmitry Borodaenko

This patch is included in Debian package of Ruby 1.8 since
1.8.6-p36 (Debian changelog entry from Mon, 23 Jul 2007
11:27:51 +0900).

Surely this has given this one-liner enough testing to prove
that it doesn't cause unwanted side effects.

Attached Files:

Name Description Download
sync.rb-1.8.6-fix.diff Download
sync.rb-1.9-fix.diff Download

Changes:

Field Old Value Date By
File Added2132: sync.rb-1.9-fix.diff2007-06-19 11:14angdraug
File Added2131: sync.rb-1.8.6-fix.diff2007-06-19 11:13angdraug