[#42945] [Ruby 1.8-Bug#4231][Open] configure.bat --with-winsock2 が socket/extconf.rbに効いていない — Masahiro Kitajima <redmine@...>

Bug #4231: configure.bat --with-winsock2 が socket/extconf.rbに効いていない

8 messages 2011/01/05

[#43027] [Ruby 1.9-Feature#4280][Assigned] SJIS should be an alias of Windows-31J, not of Shift_JIS — Usaku NAKAMURA <redmine@...>

Feature #4280: SJIS should be an alias of Windows-31J, not of Shift_JIS

13 messages 2011/01/14
[#43030] [Ruby 1.9-Feature#4280] SJIS should be an alias of Windows-31J, not of Shift_JIS — Motohiro KOSAKI <redmine@...> 2011/01/14

チケット #4280 が更新されました。 (by Motohiro KOSAKI)

[#43031] Re: [Ruby 1.9-Feature#4280] SJIS should be an alias of Windows-31J, not of Shift_JIS — "U.Nakamura" <usa@...> 2011/01/14

こんにちは、なかむら(う)です。

[#43033] Re: [Ruby 1.9-Feature#4280] SJIS should be an alias of Windows-31J, not of Shift_JIS — KOSAKI Motohiro <kosaki.motohiro@...> 2011/01/14

2011年1月14日16:35 U.Nakamura <usa@garbagecollect.jp>:

[#43039] ext/openssl development repository — Hiroshi Nakamura <nakahiro@...>

W3J1YnktY29yZTozNDQxNl3jga7ml6XmnKzlkJHjgZHniYjjgafjgZnjgIIKCuacgOi/kU1hcnRp

21 messages 2011/01/14
[#43040] Re: ext/openssl development repository — "U.Nakamura" <usa@...> 2011/01/14

こんにちは、なかむら(う)です。

[#43041] Re: ext/openssl development repository — Yusuke ENDOH <mame@...> 2011/01/14

遠藤です。

[#43053] Re: ext/openssl development repository — Hiroshi Nakamura <nakahiro@...> 2011/01/17

MjAxMS8xLzE0IFl1c3VrZSBFTkRPSCA8bWFtZUB0c2cubmUuanA+Ogo+Pj4gwqAgwqAgwqAgwqAg

[#43092] pthread_cond を用いたConditionVariable — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

15 messages 2011/01/24

[ruby-dev:43118] Re: Hashのイテレーション中の新規キー追加

From: nagachika <nagachika00@...>
Date: 2011-01-26 03:59:48 UTC
List: ruby-dev #43118
はじめまして、近永と申します。

まず、畠山さんの提示されたパッチでを 1.8.7-p330 に適用して以下のような実験をしてみると、
手元ではちゃんと要素を1回ずつ yield できていないことがわかります。

## hash_each.rb
num = 66
tbl = {}
num.times do |i| tbl[i.to_s] = i end

cnt_tbl = Hash.new{ 0 }
num.times do |i| cnt_tbl[i.to_s] = 0 end

tbl.each do |k, v|
  cnt_tbl[k] += 1
  if cnt == num/2
    tbl[(num+1).to_s] = "new"
  end
end

p cnt_tbl

## 実行結果
{"15"=>1, "36"=>1, "8"=>1, "57"=>1, "16"=>0, "37"=>1, "60"=>1, "9"=>1,
"58"=>1, "17"=>0, "40"=>0, "38"=>0, "61"=>1, "59"=>1, "20"=>0,
"18"=>0, "41"=>0, "39"=>0, "62"=>0, "21"=>0, "19"=>0, "42"=>0,
"63"=>0, "43"=>0, "64"=>1, "65"=>1, "22"=>2, "23"=>2, "44"=>2,
"24"=>2, "45"=>2, "67"=>1, "25"=>2, "46"=>2, "26"=>2, "47"=>2, "0"=>1,
"27"=>1, "50"=>2, "48"=>2, "30"=>1, "1"=>1, "28"=>1, "51"=>1, "49"=>2,
"10"=>1, "31"=>1, "2"=>1, "29"=>1, "52"=>1, "32"=>1, "3"=>1, "53"=>1,
"4"=>1, "54"=>1, "11"=>2, "5"=>1, "12"=>2, "33"=>2, "13"=>2, "34"=>2,
"6"=>2, "55"=>2, "14"=>2, "35"=>2, "7"=>2, "56"=>2}

同じ要素が2度 yield されてたり、1度も yield されない要素ができてたりします。

また、Hash#each 中に新たに要素を追加した場合、その要素についてはその Hash#each 中に
yield されるべきかどうかという仕様の問題もあるかと思います。

現実的には Hash#each の例については単に h.keys.each { ... } にすることで回避できます。

rb_hash_foreach() 中に Hash への要素追加がエラーになる現象で困ったことは
1.9 ですがわたしも経験があります。
Hash#each ではなくて、Marshal.dump と Hash#[]= を別のスレッドから呼んだ時の問題でした。
(参考: http://d.hatena.ne.jp/nagachika/20100630/ruby_hash_insert_during_marshal_dump)
ここには書いていませんが、確か結局アプリケーション側でできるだけ dRuby 転送を抑えて、
Hash#[]= している箇所でリトライするようにして回避したと思います。
"can't add a new key into hash during iteration" の例外は専用の例外クラスだったらいいなとは思いました。
参考までに。

In This Thread