From 4a42dda48262ef31125f76a0a642736281724c33 Mon Sep 17 00:00:00 2001 From: nahi Date: Mon, 27 Jun 2011 20:09:59 +0000 Subject: * thread.c (rb_thread_local_aref): RDoc fix. Thread#[] example had a race. See #4480. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 1dd13d77bb..678c16ff62 100644 --- a/thread.c +++ b/thread.c @@ -2067,17 +2067,20 @@ rb_thread_local_aref(VALUE thread, ID id) * either a symbol or a string name. If the specified variable does not exist, * returns nil. * - * a = Thread.new { Thread.current["name"] = "A"; Thread.stop } - * b = Thread.new { Thread.current[:name] = "B"; Thread.stop } - * c = Thread.new { Thread.current["name"] = "C"; Thread.stop } - * Thread.list.each {|x| puts "#{x.inspect}: #{x[:name]}" } + * [ + * Thread.new { Thread.current["name"] = "A" }, + * Thread.new { Thread.current[:name] = "B" }, + * Thread.new { Thread.current["name"] = "C" } + * ].each do |th| + * th.join + * puts "#{th.inspect}: #{th[:name]}" + * end * * produces: * - * #: C - * #: B - * #: A - * #: + * #: A + * #: B + * #: C */ static VALUE -- cgit v1.2.3