summaryrefslogtreecommitdiff
path: root/lib/thread.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-23 10:18:58 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-23 10:18:58 +0000
commit0f9b33c793f225c1b817d73e5c915050c429edc4 (patch)
tree9df2ce83ba36c8d714eae9d3362f0dca23520ee8 /lib/thread.rb
parent80b55686f0cce9c8fb2aaec6e5f957555e18f60c (diff)
* 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
Diffstat (limited to 'lib/thread.rb')
-rw-r--r--lib/thread.rb14
1 files changed, 7 insertions, 7 deletions
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