<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>suusanex</author_name>
  <author_url>https://blog.hatena.ne.jp/suusanex/</author_url>
  <blog_title>新しもの好きプログラマの耳より情報ブログ</blog_title>
  <blog_url>https://suusanex.hatenablog.jp/</blog_url>
  <categories>
  </categories>
  <description>概要 大量に発生するイベントを、いったんキューに積んであとで処理したい。しかし、キューと言っても.NETの普通のQueue&lt;T&gt;では最低限の機能しか無く、排他やイベント待ちなど自分で色々考える必要があって辛い。もっと便利に使えるものは無いか？有るぞ！という話です。 最初に結論まとめ System.Threading.Channelsを使いましょう。Pub/Subメッセージングを実現するライブラリなので、取り出す側が一つだけになるような、いわゆるキューの用途もカバーしています。こんな感じで使えます。 //初期設定 Channel&lt;int&gt; queue = Chennel.CreateUnboun…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsuusanex.hatenablog.jp%2Fentry%2F2024%2F05%2F22%2F193847&quot; title=&quot;スレッドセーフ等が付いたキューとして使えるSystem.Threading.Channels (1) 最低限の使い方を紹介 - 新しもの好きプログラマの耳より情報ブログ&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>2024-05-22 19:38:47</published>
  <title>スレッドセーフ等が付いたキューとして使えるSystem.Threading.Channels (1) 最低限の使い方を紹介</title>
  <type>rich</type>
  <url>https://suusanex.hatenablog.jp/entry/2024/05/22/193847</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
