我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

并发选择同一共享通道

I was thinking what would happen if multiple goroutines are executing select over a set of channels where one/some of them are shared amongst them and while all of them are waiting, the shared channel becomes available.

Will runtime handle this case and allow only one goroutine to access the channel and do the read/write?

The comments above all answer it. Also you can write some code and see for yourself. Something on these lines https://play.golang.org/p/4ZQLwO9wvw

近期文章

  • GoLang-创建一个JSON数组和JSON对象
  • 如何在golang中从查询结果中检查相同值并捕获第一个值
  • 如何按值对map [int] int进行排序? [重复]
  • 在Go中解析带有数组的JSON文件
  • go中的快捷方式分配,不包括空/空值
  • 运行由Go build创建的二进制文件时出现问题
  • 如何设置(或存储)使用GOPATH进行项目
  • golang:在地图值中使用定义的接口
  • 如何从map [string] MyStruct转换为map [string] MyInterface
  • 如何在golang中编译javascript代码并获得详细错误
  • 如果调用的函数来自不同的包,如何同步goroutine?
  • 如何将JSON文档中的字符串值解组为int类型的变量?
  • Go语言中的功能管道
  • 尝试在行中打印大字符串
  • 在内存地址调用func
  • 没有匿名数组吗?
  • 去http客户端不跟随重定向
  • Go新手:如何运行goroutines shell?
  • 相对日期解析
  • 如何使用指针更改属性值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华