GithubHelp home page GithubHelp logo

Comments (4)

qnikst avatar qnikst commented on September 15, 2024

Sorry for a late reply. As far as I see this function continues to check for values even the worker has exited. gatherFrom continues to check for values as well, but only while there are no more values in the chan and worker thread is alive.

It seems that such function can exit only with BlockedIndefinitelyOnSTM if there are no more threads that has a access to the chan. It feels pretty unsafe and I think that there should be better API for this case, but I may be wrong here. Can you please share the general structure of the code that uses this function, so we can check if it's the best option for the library in such a case?

from stm-conduit.

bbarker avatar bbarker commented on September 15, 2024

Hi @qnikst ,

I haven't had a chance to process all of what you said just yet (will try to read into this more soon), but I'm using this in a server context; when I used the original gatherFrom, it would exit immediately, perhaps because no TCP accept had been initiated when gatherFrom initially starts.

Here's how I used it, along with some surrounding context and discussion: google/proto-lens#372 (comment)

from stm-conduit.

qnikst avatar qnikst commented on September 15, 2024

Thanks, I'll take a deeper look, but from what I see the problem is that you immediately fork the thread from the worker, and worker exits:

serveTBQ hp port rFun tbq = do
    _ <- async $ withRunInIO $ \run -> TCP.serve hp port $ \(csock, addr) -> do

If you don't use async here then the code will work with gatherFrom.

from stm-conduit.

bbarker avatar bbarker commented on September 15, 2024

@qnikst sorry for taking a while to get back on this. I appreciate the feedback, and yes, that was indeed the issue. Hard to say why I had that async there in the first place, in retrospect.

from stm-conduit.

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.