Code Monkey home page Code Monkey logo

Comments (7)

mighe avatar mighe commented on May 22, 2024

Scala's SyncVar has a different semantic than yours, it is more like to a "single element queue", where a put on a set component just blocks the thread.
Maybe we can try to add a non-blocking try_put(value) method that returns true if the value has been set and false otherwise or a timeout to a blocking put

I don't like the name, it sounds too much "academic" and it is not well suited for everyday use, but I also think is a good building block: Ruby standard library is very poor in concurrency and those facilities are very useful.

from concurrent-ruby.

chrisseaton avatar chrisseaton commented on May 22, 2024

You're right about the semantics of SyncVar and put, and that's what MVar is - my example was wrong. The Scala semantics are what I intend to implement.

I'll go ahead and implement this as well. I'll call it SyncVar for now.

from concurrent-ruby.

jdantonio avatar jdantonio commented on May 22, 2024

I'm not familiar with Scala's SyncVar but I like the idea expressed by MVar. If Scala's SyncVar implements the desired behavior then I like the idea of basing our implementation on Scala. It fits withe the theme of this library.

from concurrent-ruby.

mighe avatar mighe commented on May 22, 2024

SynchVar seems a little too cryptic to me...
I mean: we're describing a container that can hold only one object, blocking when we try to put into another one object or if we try to get something that is not available yet.
What about Slot?

from concurrent-ruby.

jdantonio avatar jdantonio commented on May 22, 2024

I just read the documentation for Scala's SyncVar and the description therein is "A class to provide safe concurrent access to a mutable cell."

Is "Cell" a reasonable name for this class, or is that too obscure? I'm fine with SyncVar, too. It's obscure but since that's the name Scala uses there is precedent.

from concurrent-ruby.

mighe avatar mighe commented on May 22, 2024

I prefer "Cell" over "SyncVar" because it conveys the idea: we have one cell that could be empty or full with blocking operations.

from concurrent-ruby.

chrisseaton avatar chrisseaton commented on May 22, 2024

Starting implementation in #17.

from concurrent-ruby.

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.