From 210367ec889f5910e270d6ea2c7ddb8a8d939e61 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 20 Jan 1999 04:59:39 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r372, which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/sync.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/sync.rb') diff --git a/lib/sync.rb b/lib/sync.rb index b5a3fc32b3..9f9706d9ee 100644 --- a/lib/sync.rb +++ b/lib/sync.rb @@ -4,6 +4,7 @@ # $Revision$ # $Date$ # by Keiju ISHITSUKA +# modified by matz # # -- # Sync_m, Synchronizer_m @@ -43,7 +44,7 @@ unless defined? Thread fail "Thread not available for this ruby interpreter" end -require "finalize" +require "final" module Sync_m RCS_ID='-$Header$-' @@ -54,7 +55,7 @@ module Sync_m EX = :EX # Îã³°ÄêµÁ - class Err < Exception + class Err < StandardError def Err.Fail(*opt) fail self, sprintf(self::Message, *opt) end @@ -296,8 +297,8 @@ module Sync_m private :sync_try_lock_sub def sync_synchronize(mode = EX) + sync_lock(mode) begin - sync_lock(mode) yield ensure sync_unlock @@ -321,7 +322,11 @@ module Sync_m def For_primitive_object.extend_object(obj) super obj.sync_extended - Finalizer.add(obj, For_primitive_object, :sync_finalize) + # Changed to use `final.rb'. + # Finalizer.add(obj, For_primitive_object, :sync_finalize) + ObjectSpace.define_finalizer(obj) do |id| + For_primitive_object.sync_finalize(id) + end end def initialize -- cgit v1.2.3