mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (rb_ary_and): should not push frozen key string.
* array.c (rb_ary_or): ditto. * eval.c (rb_thread_schedule): should save context before raising deadlock, saved context for current thread might be obsolete. * time.c (make_time_t): non DST timezone shift supported (hopefully). * signal.c: SIGINFO added. * eval.c (rb_ensure): should not SEGV when prot_tag is NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
91fdbecbda
commit
be256c6f5a
7 changed files with 50 additions and 18 deletions
|
@ -170,7 +170,7 @@ class Queue
|
|||
Thread.critical = true
|
||||
begin
|
||||
loop do
|
||||
if @que.length == 0
|
||||
if @que.empty?
|
||||
if non_block
|
||||
raise ThreadError, "queue empty"
|
||||
end
|
||||
|
@ -184,13 +184,11 @@ class Queue
|
|||
Thread.critical = false
|
||||
end
|
||||
end
|
||||
def shift(non_block=false)
|
||||
pop(non_block)
|
||||
end
|
||||
alias deq shift
|
||||
alias shift pop
|
||||
alias deq pop
|
||||
|
||||
def empty?
|
||||
@que.length == 0
|
||||
@que.empty?
|
||||
end
|
||||
|
||||
def clear
|
||||
|
@ -223,11 +221,11 @@ class SizedQueue<Queue
|
|||
|
||||
def max=(max)
|
||||
Thread.critical = true
|
||||
if max >= @max
|
||||
if max <= @max
|
||||
@max = max
|
||||
Thread.critical = false
|
||||
else
|
||||
diff = max - @max
|
||||
diff = @max - max
|
||||
@max = max
|
||||
Thread.critical = false
|
||||
diff.times do
|
||||
|
@ -253,6 +251,7 @@ class SizedQueue<Queue
|
|||
end
|
||||
|
||||
def pop(*args)
|
||||
retval = super
|
||||
Thread.critical = true
|
||||
if @que.length < @max
|
||||
begin
|
||||
|
@ -265,7 +264,7 @@ class SizedQueue<Queue
|
|||
end
|
||||
t.run if t
|
||||
end
|
||||
super
|
||||
retval
|
||||
end
|
||||
|
||||
def num_waiting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue