From 0f9b33c793f225c1b817d73e5c915050c429edc4 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 23 Dec 2012 10:18:58 +0000 Subject: * thread.c: rename methods: from Thread.async_interrupt_timing to Thread.handle_interrupt, from Thread.async_interrupted? to Thread.pending_interrupt?. Also rename option from `defer' to `never'. [ruby-core:51074] [ruby-trunk - Feature #6762] * vm_core.c, thread.c: rename functions and data structure `async_errinfo' to `pending_interrupt'. * thread.c: add global variables sym_immediate, sym_on_blocking and sym_never. * cont.c, process.c, vm.c, signal.c: ditto. * lib/sync.rb, lib/thread.rb: catch up this renaming. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/thread.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/thread.rb') diff --git a/lib/thread.rb b/lib/thread.rb index 04847c80ab..1c8107085b 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -63,9 +63,9 @@ class ConditionVariable # even if no other thread doesn't signal. # def wait(mutex, timeout=nil) - Thread.async_interrupt_timing(StandardError => :defer) do + Thread.handle_interrupt(StandardError => :never) do begin - Thread.async_interrupt_timing(StandardError => :on_blocking) do + Thread.handle_interrupt(StandardError => :on_blocking) do @waiters_mutex.synchronize do @waiters[Thread.current] = true end @@ -84,7 +84,7 @@ class ConditionVariable # Wakes up the first thread in line waiting for this lock. # def signal - Thread.async_interrupt_timing(StandardError => :on_blocking) do + Thread.handle_interrupt(StandardError => :on_blocking) do begin t, _ = @waiters_mutex.synchronize { @waiters.shift } t.run if t @@ -99,7 +99,7 @@ class ConditionVariable # Wakes up all threads waiting for this lock. # def broadcast - Thread.async_interrupt_timing(StandardError => :on_blocking) do + Thread.handle_interrupt(StandardError => :on_blocking) do threads = nil @waiters_mutex.synchronize do threads = @waiters.keys @@ -160,7 +160,7 @@ class Queue # Pushes +obj+ to the queue. # def push(obj) - Thread.async_interrupt_timing(StandardError => :on_blocking) do + Thread.handle_interrupt(StandardError => :on_blocking) do @mutex.synchronize do @que.push obj @cond.signal @@ -184,7 +184,7 @@ class Queue # thread isn't suspended, and an exception is raised. # def pop(non_block=false) - Thread.async_interrupt_timing(StandardError => :on_blocking) do + Thread.handle_interrupt(StandardError => :on_blocking) do @mutex.synchronize do while true if @que.empty? @@ -300,7 +300,7 @@ class SizedQueue < Queue # until space becomes available. # def push(obj) - Thread.async_interrupt_timing(RuntimeError => :on_blocking) do + Thread.handle_interrupt(RuntimeError => :on_blocking) do @mutex.synchronize do while true break if @que.length < @max -- cgit v1.2.3