Giter VIP home page Giter VIP logo

Comments (4)

fitzgen avatar fitzgen commented on July 30, 2024 1

Why not both?

Ah, yeah it is true that it could work in either situation. I expect that using a custom channel based on shared memory will be much faster than postMessage when multithreading is available but there is no technical reason why you couldn't still use postMessage. Although, the receiver thread would have to return the to event loop to be woken up by the postMessage...

from gloo.

Pauan avatar Pauan commented on July 30, 2024

this is for when we are not using shared memory and multithreading

Why not both?

from gloo.

hamza1311 avatar hamza1311 commented on July 30, 2024

I think basic the implementation would like this:

struct Worker<T> {
     raw: web_sys::Worker
     _data: PhantomData<T> 
};

impl<T> Worker {
    fn new(path: impl AsRef<str>) -> Self {
        let worker = web_sys::Worker::new(path)
        Self { worker, _data: PhantomData }
    }

    fn split(self) -> (Sender<T>, Reciever<T>) { ... }
}

impl<T> Stream for Worker<T> { ...  }

impl<T> Sink for Worker<T> { ...  }

This would of course be based on futures. Once this basic implementation is in place, all the bells and whistles (if needed) could be added later.

from gloo.

hamza1311 avatar hamza1311 commented on July 30, 2024

Done in #180

from gloo.

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.