惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

浩瀚星河 - 个人技术博客

工作中如何做好技术积累 wrk压测工具 千万级 Mysql 表结构变更实战 MySql主从复制 Go遍历时删除特定元素 Golang中的优雅关闭与退出 Github CI自动发版 git-filter-repo 清理敏感信息 初识mcp server 短视频的推荐算法 webhook是什么 GitLab Runner 使用与 CICD 全面指南 Go Zap实现日志双写和切割 canal安装与使用 kafka-go使用 go-elasticsearch使用指南 elasticsearch安装与使用 kratos中proto文件引入其他proto爆红 go中的defer 腾讯云发送短信 什么是勇敢 go中的方法提升 docker部署mysql中文乱码问题 10万行报表导出优化实战:从 OFFSET 到游标分页 不急于求成,才是最长远的成长 redis在go中的实践 go 反射 go timer定时器 go context学习之旅 go jwt和redis实现用户登录注册以及查询 go中的panic和recover channel的select case控制语句 channel之生产者消费者模型 缓冲区为 1 和无缓冲区的 channel 有什么区别 channel 基本概念 使用minio的go sdk上传文件 wire优雅的管理go项目
channel实现简易eventbus
浩瀚星河 · 2025-08-07 · via 浩瀚星河 - 个人技术博客

本文介绍了一个适用于单机模块的 Go 语言事件总线(Eventbus)实现,用于异步事件的发布与订阅。通过 map[string]*EventChans 管理事件与多个通道的映射关系,并结合读写锁 sync.RWMutex 保证并发安全,实现了 Subscribe、UnSubscribe、Publish 三个核心方法,展示了如何安全高效地进行事件分发。适合 Go 初学者理解 channel 和并发控制。