File tree Expand file tree Collapse file tree 4 files changed +50
-10
lines changed Expand file tree Collapse file tree 4 files changed +50
-10
lines changed Original file line number Diff line number Diff line change
1
+ Wed June 9 01:05:00 Kirk Haines <khaines@ruby-lang.org>
2
+
3
+ * lib/monitor.rb: Backport #2240 [ruby-core:26185]; backport r25420 to ensure that the scheduled thread is alive when a monitor is released.
4
+ * test/monitor/test_monitor.rb: Backport #2240 [ruby-core:26185]; added a test for the above functionality.
5
+
6
+
1
7
Tue Jun 8 23:45:00 2010 Kirk Haines <khaines@ruby-lang.org>
2
8
3
- * regexp.c: Backport #3403; backported from r28192 to fix a bug with non-greedy matching.
4
- * test/ruby/test_regexp.rb: Backport #3403; added this test suite, commenting out inapplicable tests to the current 1.8.6.
5
- * ChangeLog: Got my date wrong in the last few entries. Tuesday is the 8th, not the 9th!
9
+ * regexp.c: Backport #3403; backported from r28192 to fix a bug with non-greedy matching. r28231
10
+ * test/ruby/test_regexp.rb: Backport #3403; added this test suite, commenting out inapplicable tests to the current 1.8.6. r28231
11
+ * ChangeLog: Got my date wrong in the last few entries. Tuesday is the 8th, not the 9th! r28231
6
12
7
13
Tue Jun 8 20:40:00 2010 Kirk Haines <khaines@ruby-lang.org>
8
14
Original file line number Diff line number Diff line change @@ -288,11 +288,15 @@ def mon_acquire(queue)
288
288
@mon_owner = Thread . current
289
289
end
290
290
291
+ # mon_release requires Thread.critical == true
291
292
def mon_release
292
293
@mon_owner = nil
293
- t = @mon_waiting_queue . shift
294
- t = @mon_entering_queue . shift unless t
295
- t . wakeup if t
294
+ while t = @mon_waiting_queue . shift || @mon_entering_queue . shift
295
+ if t . alive?
296
+ t . wakeup
297
+ return
298
+ end
299
+ end
296
300
end
297
301
298
302
def mon_enter_for_cond ( count )
Original file line number Diff line number Diff line change @@ -54,6 +54,32 @@ def test_synchronize
54
54
assert_equal ( ( 1 ..10 ) . to_a , ary )
55
55
end
56
56
57
+ def test_killed_thread_in_synchronize
58
+ ary = [ ]
59
+ queue = Queue . new
60
+ t1 = Thread . start {
61
+ queue . pop
62
+ @monitor . synchronize {
63
+ ary << :t1
64
+ }
65
+ }
66
+ t2 = Thread . start {
67
+ queue . pop
68
+ @monitor . synchronize {
69
+ ary << :t2
70
+ }
71
+ }
72
+ @monitor . synchronize do
73
+ queue . enq ( nil )
74
+ queue . enq ( nil )
75
+ assert_equal ( [ ] , ary )
76
+ t1 . kill
77
+ t2 . kill
78
+ ary << :main
79
+ end
80
+ assert_equal ( [ :main ] , ary )
81
+ end
82
+
57
83
def test_try_enter
58
84
queue1 = Queue . new
59
85
queue2 = Queue . new
@@ -94,6 +120,10 @@ def test_cond
94
120
assert_equal ( true , result1 )
95
121
assert_equal ( "bar" , a )
96
122
end
123
+ end
124
+
125
+ def test_timedwait
126
+ cond = @monitor . new_cond
97
127
98
128
b = "foo"
99
129
queue2 = Queue . new
Original file line number Diff line number Diff line change 1
1
#define RUBY_VERSION "1.8.6"
2
- #define RUBY_RELEASE_DATE "2010-06-08 "
2
+ #define RUBY_RELEASE_DATE "2010-06-09 "
3
3
#define RUBY_VERSION_CODE 186
4
- #define RUBY_RELEASE_CODE 20100608
5
- #define RUBY_PATCHLEVEL 407
4
+ #define RUBY_RELEASE_CODE 20100609
5
+ #define RUBY_PATCHLEVEL 408
6
6
7
7
#define RUBY_VERSION_MAJOR 1
8
8
#define RUBY_VERSION_MINOR 8
9
9
#define RUBY_VERSION_TEENY 6
10
10
#define RUBY_RELEASE_YEAR 2010
11
11
#define RUBY_RELEASE_MONTH 6
12
- #define RUBY_RELEASE_DAY 8
12
+ #define RUBY_RELEASE_DAY 9
13
13
14
14
#ifdef RUBY_EXTERN
15
15
RUBY_EXTERN const char ruby_version [];
You can’t perform that action at this time.
0 commit comments