<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>akira2kun</author_name>
  <author_url>https://blog.hatena.ne.jp/akira2kun/</author_url>
  <blog_title>技術とか戦略とか</blog_title>
  <blog_url>https://akira2kun.hatenablog.com/</blog_url>
  <categories>
    <anon>C#</anon>
  </categories>
  <description>排他制御の仕組みとして先日Mutexを取り上げました（https://akira2kun.hatenablog.com/entry/2020/04/12/170559）。今回は、同じく排他制御で使われるセマフォについて取り上げます。 セマフォがMutexと異なる点は、複数のプロセス・スレッドが資源を取得することができることです。セマフォのコンストラクタで初期で解放する資源数や、解放できる資源の最大数を指定します。WaitOne関数で資源取得待ちを行い、Release関数で資源解放を行います。Release関数の引数で資源解放数を指定することもできます。（ただし、最大数を超える資源を開放するとS…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fakira2kun.hatenablog.com%2Fentry%2F2020%2F05%2F09%2F135412&quot; title=&quot;C#：セマフォを用いた排他制御 - 技術とか戦略とか&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>2020-05-09 13:54:12</published>
  <title>C#：セマフォを用いた排他制御</title>
  <type>rich</type>
  <url>https://akira2kun.hatenablog.com/entry/2020/05/09/135412</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
