<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>协程 - 标签 - 研发日志 · R&amp;D Log</title><link>https://rd163.visword.com/tags/%E5%8D%8F%E7%A8%8B/</link><description>协程 - 标签 - 研发日志 · R&amp;D Log</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>whutluohui@gmail.com (小智晖)</managingEditor><webMaster>whutluohui@gmail.com (小智晖)</webMaster><copyright>本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。</copyright><lastBuildDate>Sun, 06 Apr 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://rd163.visword.com/tags/%E5%8D%8F%E7%A8%8B/" rel="self" type="application/rss+xml"/><item><title>c++20协程简介</title><link>https://rd163.visword.com/posts/cpp20-corouting-intro/</link><pubDate>Sun, 06 Apr 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/cpp20-corouting-intro/</guid><description><![CDATA[<h2 id="c20-协程简介" class="headerLink">
    <a href="#c20-%e5%8d%8f%e7%a8%8b%e7%ae%80%e4%bb%8b" class="header-mark"></a>C++20 协程简介</h2><p>参考：</p>
<ul>
<li><a href="https://github.com/0voice/cpp_backend_awsome_blog/blob/main/%E3%80%90NO.241%E3%80%91%E5%8D%8F%E7%A8%8B%E5%8F%8Ac%2B%2B%2020%E5%8E%9F%E7%94%9F%E5%8D%8F%E7%A8%8B%E7%A0%94%E7%A9%B6%E6%8A%A5%E5%91%8A.md" target="_blank" rel="noopener noreferrer">协程及 C++ 20 原生协程研究报告</a></li>
<li><a href="https://0cch.com/uploads/2022/02/k&#43;2021.pdf" target="_blank" rel="noopener noreferrer">2021K+ 全球软件研发行业创新峰会：深入解析 C++20 协程（PDF）</a></li>
</ul>
<p>C++20 协程通过 Promise 和 Awaitable 接口的十余个函数，向程序员暴露出定制协程流程和行为的入口。实现一个最简单的协程，通常需要用到其中的 8 个（5 个 Promise 函数 + 3 个 Awaitable 函数）。下面先从 Awaitable 的 3 个函数说起。</p>]]></description></item><item><title>C++协程介绍</title><link>https://rd163.visword.com/posts/fiber-intro-for-cpp/</link><pubDate>Mon, 31 Mar 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/fiber-intro-for-cpp/</guid><description><![CDATA[<h2 id="协程coroutine与纤程fiber区别" class="headerLink">
    <a href="#%e5%8d%8f%e7%a8%8bcoroutine%e4%b8%8e%e7%ba%a4%e7%a8%8bfiber%e5%8c%ba%e5%88%ab" class="header-mark"></a>协程（coroutine）与纤程（fiber）区别</h2><h3 id="协程coroutine" class="headerLink">
    <a href="#%e5%8d%8f%e7%a8%8bcoroutine" class="header-mark"></a>协程（Coroutine）</h3><p>N:1 协程。</p>
<p>协程是语言级别的特性（C++20 原生支持），由编译器生成状态机逻辑，通过 <code>co_await</code>、<code>co_yield</code> 等关键字实现隐式挂起和恢复，无需直接操作底层上下文。</p>]]></description></item></channel></rss>