diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-09 16:07:41 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-09 16:07:41 +0000 |
commit | 08e1428b7bf2baaa9fefeacfaef518dc75cc9c64 (patch) | |
tree | 90f61fe0e3eba2898ed2f2e03843baf5a890fc7c /lib | |
parent | f0e5252835e5492333e9d223be043781d91667ce (diff) |
merge revision(s) 44595: [Backport #9342]
* ext/thread/thread.c (rb_szqueue_clear): notify SZQUEUE_WAITERS
on SizedQueue#clear. [ruby-core:59462] [Bug #9342]
* test/thread/test_queue.rb: add test. the patch is from
Justin Collins.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/thread.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/thread.rb b/lib/thread.rb index 1c8107085b..b140a9e445 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -319,6 +319,18 @@ class SizedQueue < Queue end # + # Removes all objects from the queue. + # + def clear + super + @mutex.synchronize do + @max.times do + @enque_cond.signal + end + end + end + + # # Alias of push # alias << push |