开发者

Is File#print atomic when given multiple arguments?

开发者 https://www.devze.com 2022-12-25 06:41 出处:网络
F开发者_JS百科or C-based implementations of ruby 1.8 and ruby 1.9, is File#print atomic when it is given multiple arguments?Examining it empirically, the answer\'s no.

F开发者_JS百科or C-based implementations of ruby 1.8 and ruby 1.9, is File#print atomic when it is given multiple arguments?


Examining it empirically, the answer's no.

10.times do
  Thread.new do
    print "foo", "\n"
  end
end

gives (in ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0])

foofoofoo
foo
foo
foo
foo
foo
foo
foo

Don't know where you can look up what is atomic and what isn't atomic, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消