<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>unageanu</author_name>
  <author_url>https://blog.hatena.ne.jp/unageanu/</author_url>
  <blog_title>うなの日記</blog_title>
  <blog_url>https://unageanu.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Thread#raiseで、任意のスレッドで強制的に例外を発生させることが可能です。 例外なので、スレッド内で捕捉(catch)して処理を振り別けることができます。 ensureブロックもちゃんと実行されます。 t = Thread.fork { begin p &quot;start&quot; i = 0 while true p i+=1 sleep 0.2 end p &quot;end&quot; # ここには来ない ensure p &quot;ensure&quot; end } sleep 1 t.raise RuntimeError, &quot;stop.&quot; t.value #スレッド内で発生した例外がスローされる 実行結果です。 &quot;star…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Funageanu.hatenablog.com%2Fentry%2F20090630%2F1246359982&quot; title=&quot; Thread#raise - うなの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-06-30 20:06:22</published>
  <title> Thread#raise</title>
  <type>rich</type>
  <url>https://unageanu.hatenablog.com/entry/20090630/1246359982</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
