Skip to content

Commit 1ef33a5

Browse files
committed
merge revision(s) 44852: [Backport ruby#9343]
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and limit wakeups. [Bug ruby#9343][ruby-core:60517] * test/thread/test_queue.rb (test_sized_queue_assign_max): test for bug git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@44863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 7b38343 commit 1ef33a5

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Thu Feb 6 08:23:28 2014 Eric Wong <e@80x24.org>
2+
3+
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and
4+
limit wakeups. [Bug #9343][ruby-core:60517]
5+
* test/thread/test_queue.rb (test_sized_queue_assign_max):
6+
test for bug
7+
18
Thu Feb 6 11:27:39 2014 Eric Hodel <drbrain@segment7.net>
29

310
* lib/rubygems: RubyGems 2.2.2 which contains the following bug fixes:

ext/thread/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ rb_szqueue_max_set(VALUE self, VALUE vmax)
437437
diff = max - GET_SZQUEUE_ULONGMAX(self);
438438
}
439439
RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
440-
while (diff > 0 && !NIL_P(t = rb_ary_shift(GET_QUEUE_QUE(self)))) {
440+
while (diff-- > 0 && !NIL_P(t = rb_ary_shift(GET_SZQUEUE_WAITERS(self)))) {
441441
rb_thread_wakeup_alive(t);
442442
}
443443
return vmax;

test/thread/test_queue.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ def test_sized_queue_assign_max
5555
assert_equal(1, q.max)
5656
assert_raise(ArgumentError) { q.max = -1 }
5757
assert_equal(1, q.max)
58+
59+
before = q.max
60+
q.max.times { q << 1 }
61+
t1 = Thread.new { q << 1 }
62+
sleep 0.01 until t1.stop?
63+
q.max = q.max + 1
64+
assert_equal before + 1, q.max
5865
end
5966

6067
def test_queue_pop_interrupt

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.1"
22
#define RUBY_RELEASE_DATE "2014-02-06"
3-
#define RUBY_PATCHLEVEL 26
3+
#define RUBY_PATCHLEVEL 27
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 2

0 commit comments

Comments
 (0)