duanmen8491 2017-09-18 09:37
浏览 7

有什么办法可以推到golang频道的最前面吗?

In golang channels, the element pushed last is consumed last. But is there a way to push element to the "front" of the channel so that the element get a chance to get consumed out of turn? Assume elements 1,2,3,4,5,6,7,8 are added to the channel and element 4 failed to process (1,2,3 are processed successfully). In this case I want to push the element 4 again to the channel in such a way that it may get a chance to get processed before elements 5,6,7,8 and subsequent elements added (if they are not already pulled from the channel for processing). This can be easily achieved using blocking queues. But I don't want to use them.

  • 写回答

2条回答 默认 最新

  • duanmei1350 2017-09-18 09:39
    关注

    But is there a way to push element to the "front" of the channel

    No there is not.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100