<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Gen_event on PlumePHP</title><link>https://plumephp.com/tags/gen_event/</link><description>Recent content in Gen_event on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 26 Sep 2026 09:00:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/gen_event/index.xml" rel="self" type="application/rss+xml"/><item><title>Erlang gen_statem 状态机与 gen_event 事件管理深度解析</title><link>https://plumephp.com/erlang-gen-statem-machine/</link><pubDate>Sat, 26 Sep 2026 09:00:00 +0800</pubDate><guid>https://plumephp.com/erlang-gen-statem-machine/</guid><description>&lt;p&gt;状态机是表达复杂业务流程最自然的抽象：连接建立与断开、支付状态流转、协议握手、任务调度，都能用一组有限状态和状态间转移精确描述。OTP 从 &lt;code&gt;gen_fsm&lt;/code&gt; 演进到 &lt;code&gt;gen_statem&lt;/code&gt;，把状态机的表达能力提升到了新的高度——它同时支持 State Functions 与 Handle Event 两种回调模式，内置延迟事件、状态超时、事后延迟（postpone）等机制。与之互补的 &lt;code&gt;gen_event&lt;/code&gt; 则提供了多处理器订阅事件流的发布-订阅框架。本文将从设计动机出发，深入这两种行为模式的回调契约、运行时语义与生产实践。&lt;/p&gt;</description></item></channel></rss>