Coder Social home page Coder Social logo

Comments (8)

deckarep avatar deckarep commented on July 19, 2024 2

Yes it is a bug where if you don't fully consume from the channel and break early, you will experience a leaked goroutine.

This is why there is another function called Iterator which allows you to signal that you're done early when iterating and notify the channel.

The better solution which is on my list is to have Iterator take a cancelable Context which is the better pattern for this type of scenario.

I'll be implementing it soon.

from golang-set.

dayuoba avatar dayuoba commented on July 19, 2024

if someone outside, has the returned channel and he does not consume all the channel msgs, the lock has the potential of being a deaded lock

from golang-set.

gitbufenshuo avatar gitbufenshuo commented on July 19, 2024
  • 没有停止机制

  • 我就不明白了,一个【小写】的结构体拥有一个【大写】的方法这种事情就这么好玩?【应该尽量不这么写,🙃😆】

from golang-set.

andy-zhangtao avatar andy-zhangtao commented on July 19, 2024

I think we should analysis code with application context. Simply looks this function seems right, no bug here.

from golang-set.

deckarep avatar deckarep commented on July 19, 2024

Here is the related thread: #33

from golang-set.

lkiversonlk avatar lkiversonlk commented on July 19, 2024

BTW, it's not the common usage pattern of Iterator

from golang-set.

gravitywp avatar gravitywp commented on July 19, 2024

@deckarep Thanks for your reply. Seem to be the right answer to me. Should I close the issue?

from golang-set.

deckarep avatar deckarep commented on July 19, 2024

from golang-set.

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.