diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-16 09:05:54 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-16 09:05:54 +0000 |
commit | f84f4aa6b375290386c0456ac02fe8f6cc2cdd2d (patch) | |
tree | fba985cc67803c80f7761462f79cf988cbf6507b /lib | |
parent | 59d82a928a617889c18f4da6152f11c0eb6fde06 (diff) |
* 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).
* time.c (make_time_t): strict range detection for negative time_t.
* 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/trunk@1399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/open3.rb | 1 | ||||
-rw-r--r-- | lib/thread.rb | 39 |
2 files changed, 25 insertions, 15 deletions
diff --git a/lib/open3.rb b/lib/open3.rb index 58de740393..33701bbfc0 100644 --- a/lib/open3.rb +++ b/lib/open3.rb @@ -32,6 +32,7 @@ module Open3 exec(*cmd) } + exit! } pw[0].close diff --git a/lib/thread.rb b/lib/thread.rb index 559cd95a8a..34db9c3d46 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -3,6 +3,7 @@ # $Date$ # by Yukihiro Matsumoto <[email protected]> # +# Copyright (C) 2001 Yukihiro Matsumoto # Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Information-technology Promotion Agency, Japan # @@ -74,7 +75,10 @@ class Mutex retry end Thread.critical = false - t.run if t + begin + t.run if t + rescue ThreadError + end self end @@ -160,17 +164,19 @@ class Queue ensure Thread.critical = false end - t.run if t - end - def enq(obj) - push(obj) + begin + t.run if t + rescue ThreadError + end end + alias << push + alias enq push def pop(non_block=false) Thread.critical = true begin loop do - if @que.length == 0 + if @que.empty? if non_block raise ThreadError, "queue empty" end @@ -184,17 +190,15 @@ 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 - @que.replace([]) + @que.clear end def length @@ -223,7 +227,7 @@ class SizedQueue<Queue def max=(max) Thread.critical = true - if max >= @max + if max <= @max @max = max Thread.critical = false else @@ -251,8 +255,10 @@ class SizedQueue<Queue end super end + alias << push def pop(*args) + retval = super Thread.critical = true if @que.length < @max begin @@ -263,9 +269,12 @@ class SizedQueue<Queue ensure Thread.critical = false end - t.run if t + begin + t.run if t + rescue ThreadError + end end - super + retval end def num_waiting |