зеркало из https://github.com/github/ruby.git
* 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:
Родитель
801bac0977
Коммит
4a42dda482
|
@ -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
|
||||
|
|
19
thread.c
19
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 <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
|
||||
|
|
Загрузка…
Ссылка в новой задаче