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

在Go中编写int32原子操作吗?

I know that in Java writing of int (32bit) is an atomic operation. What about Go? Can go-routine be aborted in the middle when writing to int32, e.g. after writing first 16 bits?

The only way to guarantee atomicity is to use the atomic package, which is great for int32, and many other basic types. For more complex data types, you'll have to use other synchronization mechanisms, because atomicity may not be possible.

近期文章

  • 在Go中使用没有文件的io.WriteSeeker
  • 网易新闻客户端viewpageer
  • 为什么要在init()中检查nil
  • 处理大型csv文件并限制goroutines
  • 在Linux上使用confluent-kafka-go构建Go应用程序
  • 使用星号(*)在Go中指定宽度和精度
  • 在封闭的net.Conn上写入,但返回nil错误
  • 如何在Golang中使用命令执行SQL文件
  • 在其他类型上使用特定数字类型的含义是什么
  • Golang:正在以Content-Type发送文本的CSS文件:纯文本/纯文本[关闭]
  • 开始-分配多个变量时出错
  • Go中是否有类似于PHP的isset()的函数?
  • 在golang中:防止子进程从调用进程接收信号
  • 为什么Go用^而不是〜来表示一元非位? [关闭]
  • Postgres错误在数据库上运行查询:无法检测默认用户名
  • 我的迭代函数有什么问题
  • 我如何将reflect.New的返回值转换回原始类型
  • 执行:扩展未命名的类型,例如[] string
  • 无法使FindId工作(GO + MGO)
  • Beego-创建模型表格和ORM

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华