summaryrefslogtreecommitdiff
path: root/lib/sync.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sync.rb')
-rw-r--r--lib/sync.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/sync.rb b/lib/sync.rb
index b5a3fc3..9f9706d 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