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

len(通道)在Go线程安全吗?

A channel can potentially be used by multiple Go routines. Is getting the length of the channel by using len(channel) from some of the Go routines thread-safe?

It kind of depends on your use case

it is indeed safe to call, but the result cannot be trusted when other goroutines are sending / taking from that channel

近期文章

  • 将对Redis实例的引用传递给Gorilla / Mux处理程序
  • 在Go中对未签名的int进行排序
  • “ go get -d”之后如何构建?
  • Go中的可变阴影
  • 声明并未使用的变量
  • 将接口{}转换为字符串数组
  • go-使用struct读取二进制文件
  • Go中独特功能的集合
  • golang json解码带有空的请求主体
  • Logrus向contextlogger添加额外的字段
  • 如何在界面中使用类型别名
  • getchar()函数中对回车符的一些疑问
  • 求解决S-Function运行提示error:flag=3 at time 0.0 输入参数不足,附代码
  • c语言怎样更改指针的指向?求大佬解答!
  • 根据如下表格内容如何设计数据库表(Mysql)?
  • TQ2440开发板红外报警:LINUX驱动程序开发+QT应用程序,开发板与门磁传感器相连,开发板收到报警信号后在屏幕显示报警信息?
  • Cry,men,not crime 怎么来写
  • Everyone is No.1 代码的思想
  • Lead A Healthy Life
  • Identity Card 怎么来编写

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华