{"categories":["Ruby"],"title":"Ractor \u3067\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217","published":"2022-03-23 10:28:42","author_url":"https://blog.hatena.ne.jp/obelisk2/","url":"https://obelisk.hatenablog.com/entry/2022/03/23/102842","height":"190","provider_url":"https://hatena.blog","version":"1.0","blog_url":"https://obelisk.hatenablog.com/","description":"\u307e\u305a\u306f\u5c0f\u624b\u8abf\u3079 take\u3059\u308b\u307e\u3067\u5f85\u3063\u3066\u3001take\u3059\u308b\u305f\u3073\u306b\u7121\u9650\u306b\u540c\u3058\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3057\u3066\u304f\u308c\u308b Ractor \u306f\u3001\u300cPull\u578b\u901a\u4fe1\u300d\u3092\u4f7f\u3063\u3066\u3053\u3093\u306a\u98a8\u306b\u4f5c\u308c\u308b\u3002 r = Ractor.new do loop { Ractor.yield 1 } end Array.new(5) { r.take } #=>[1, 1, 1, 1, 1] \u308f\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u306d\u3002\u3067\u306f\u3001\u4f8b\u3048\u3070\u5358\u8abf\u5897\u52a0\u5217\u3082\u7c21\u5358\u306b\u4f5c\u308c\u308b\u3002 r = Ractor.new do i = 1 loop do Ractor.yield i i += 1 end end Array.new(5) { r.take } #=>[1, 2, 3, 4,\u2026","image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2022%2F03%2F23%2F102842\" title=\"Ractor \u3067\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217 - Camera Obscura\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","provider_name":"Hatena Blog","author_name":"obelisk2","blog_title":"Camera Obscura","type":"rich"}