小结:

1、

When a goroutine sends a value to a channel, we can view the goroutine releases the ownership of some values. When a goroutine receives a value from a channel, we can view the goroutine acquires the ownerships of some values.

Surely, there may be also not any ownership transferred along with channel communications.

The values (whose ownerships are transferred) are often referenced (but are not required to be referenced) by the transferred value. Please note, here, when we talk about ownership, we mean the ownership from the logic view. Unlike Rust language, Go doesn't ensure value ownership from the syntax level. Go channels can help programmers write data races free code easily, but Go channels can't prevent programmers from writing bad concurrent code from the syntax level.

2、

only channel is first-class citizen in Go. Channel is one kind of types in Go, so we can use channels without importing any packages. On the other hand, those traditional concurrency synchronization techniques are provided in the sync and sync/atomic standard packages.

Honestly, each concurrency synchronization technique has its own best use scenarios.

3、

One problem of channels is, the experience of programming with channels is so enjoyable and fun that programmers often even prefer to use channels for the scenarios which channels are not best for.

Channels in Go - Go 101: an online Go programming book + knowledge base https://go101.org/article/channel.html

How to Gracefully Close Channels - Go 101: an online Go programming book + knowledge base https://go101.org/article/channel-closing.html

Channel Use Cases - Go 101: an online Go programming book + knowledge base https://go101.org/article/channel-use-cases.html

最新文章

  1. MySQL 5.6 主从复制如何处理——触发器,函数,存储过程,调度事件
  2. 【NS2仿真】TCP协议
  3. 桥牌笔记:Skill Level 4 D8
  4. python 关键字参数
  5. 用MATLAB画函数的曲线
  6. 腾讯QQ、新浪微博等知名社交网络图标素材
  7. js 拖拽实现
  8. MongoDB学习总结(四) —— 索引的基本用法
  9. 201521123060 《Java程序设计》第7周学习总结
  10. Spring + Fastweixin 微信开发
  11. springboot学习笔记-4 整合Druid数据源和使用@Cache简化redis配置
  12. Postgres中postmaster代码解析(上)
  13. 设计模式总结篇系列:适配器模式(Adapter)
  14. Spring集成Quarz开发环境搭建
  15. [rook] rook的控制流
  16. solr搜索分词优化
  17. 最短路计数——Dijkstra
  18. React-使用styled-components
  19. VS2012 安装番茄插件
  20. 潭州课堂25班:Ph201805201 WEB 之 页面编写 第一课 (课堂笔记)

热门文章

  1. Windows7里面怎么实现FTP服务功能
  2. js对flv提取h264、aac音视频流
  3. ROS代码经验系列-- tf进行位置查询变换
  4. tcp上传学习二--文本文件上传
  5. Python & Matplotlib: Monte Carlos Method
  6. erlang开发环境(IDE)搭建
  7. 在onelogin中使用OpenId Connect Implicit Flow
  8. MariaDB Galera Cluster集群搭建
  9. 项目实战--idea中使用Git遇到的坑
  10. Lesson_strange_words3