* 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
This commit is contained in:
nahi 2011-06-27 20:09:59 +00:00
Родитель 801bac0977
Коммит 4a42dda482
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Tue Jun 28 05:03:32 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
* thread.c (rb_thread_local_aref): RDoc fix. Thread#[] example
had a race. See #4480.
Tue Jun 28 01:22:00 2011 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log from

Просмотреть файл

@ -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 <code>nil</code>.
*
* 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
*
* <em>produces:</em>
*
* #<Thread:0x401b3b3c sleep>: C
* #<Thread:0x401b3bc8 sleep>: B
* #<Thread:0x401b3c68 sleep>: A
* #<Thread:0x401bdf4c run>:
* #<Thread:0x00000002a54220 dead>: A
* #<Thread:0x00000002a541a8 dead>: B
* #<Thread:0x00000002a54130 dead>: C
*/
static VALUE