<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>NetPenguin</author_name>
  <author_url>https://blog.hatena.ne.jp/NetPenguin/</author_url>
  <blog_title>NetPenguinの日記</blog_title>
  <blog_url>https://netpenguin.hatenadiary.org/</blog_url>
  <categories>
    <anon>JAVA</anon>
  </categories>
  <description>上のほうで wait と notify について触れましたが、何も例示していなかったのでちょっと書いてみます。 wait と notify を利用したパターンで私がよく行なうのは、busy-wait なループの代わりに wait と notify を使用することです。たとえば flag が true になるまで待つという busy-wait なループは以下のようになります。 while( !flag ) Thread.sleep( 500 ); 上記の場合、500ms 毎に flag に対する検査処理が走り、CPUを無駄に消費します。 synchronized, wait を利用すると以下のよ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnetpenguin.hatenadiary.org%2Fentry%2F20040616%2F1087402143&quot; title=&quot;wait と notify - NetPenguinの日記&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>2004-06-16 01:09:03</published>
  <title>wait と notify</title>
  <type>rich</type>
  <url>https://netpenguin.hatenadiary.org/entry/20040616/1087402143</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
