Giter Club home page Giter Club logo

Comments (5)

tswcbyy1107 avatar tswcbyy1107 commented on July 27, 2024

一个发送者,N 个接收者
这里 具备广播功能 只能是无缓冲对列和举例不符合, 这里应该只是stopCh的关闭被多个select监听到了,和是否有缓冲无关

from golangcodingtime.

ZGY1999 avatar ZGY1999 commented on July 27, 2024

N个发送者 1一个接收者 感觉第一段select 检查提前退出这部分代码无用啊,不知道是不是我理解有问题

from golangcodingtime.

ZGY1999 avatar ZGY1999 commented on July 27, 2024

N个发送者 多个接收者代码部分 我个人感觉非缓存的媒介通道也可以实现这个效果啊

from golangcodingtime.

KawhiZhuuu avatar KawhiZhuuu commented on July 27, 2024

N个发送者 1一个接收者 感觉第一段select 检查提前退出这部分代码无用啊,不知道是不是我理解有问题

作者这里没提及一个select的重点,select当多个case可以执行时,并不是像其他语言一样,选择代码中相对靠上的case执行,而是随机执行,所以,如果没有第一段的select,第二段的select可能在极端情况下,始终执行业务channel的case,导致协程无法退出

from golangcodingtime.

lyz790687525 avatar lyz790687525 commented on July 27, 2024

现在的话,是否可以用context来替代

from golangcodingtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.