dsij89625 2013-09-07 14:20
浏览 3
已采纳

App Engine Channel API的线程安全性/原子性

What happens when I try to send a message with Google App Engine's Channel API but from two or more goroutines and/or task queues? e.g.

go channel.Send(context, clientID, "Hello")
go channel.Send(context, clientID, "World")

I understand that in GAE Go, all goroutines are multiplexed onto a single thread. However this still allows for pre-emption during I/O, and presumably channel sends qualify as I/O.

The GAE dev server seems to serialize all requests so I don't see any channel sends overlapping. The production server seems to allow some request concurrency but the channel sends appear atomic or at least safe to call from different threads/goroutines.

  • 写回答

1条回答 默认 最新

  • douzhuanqian8244 2013-09-10 01:10
    关注

    In general, App Engine API calls are fine to call concurrently as long as they are not going to be writing to the same memory (e.g. two datastore.Get calls using the same destination struct is not safe).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?