Giter Club home page Giter Club logo

Comments (6)

yellowsink avatar yellowsink commented on July 16, 2024

If it is simply the case that threads may only wait for events created on their own thread, I think this should be documented more clearly, but that also would significantly increase the difficulty of syncing threads so I'm hoping this is just a bug that can be fixed!

from eventcore.

s-ludwig avatar s-ludwig commented on July 16, 2024

The problem here is that each event ID is only valid for the event driver instance that created it. So in order to wait from another thread, you have to pass the main thread's eventDriver as cast(shared)eventDriver to the other thread and then call the shared overload of wait there. I'll add some documentation for this.

from eventcore.

yellowsink avatar yellowsink commented on July 16, 2024

ah! I was aware of shared trigger but not shared wait. doesn't this mean that you'd need to use a shared processevents too, though?
I suppose the only way to do what I want is to make sure it's constructed on the second thread... should be doable

from eventcore.

s-ludwig avatar s-ludwig commented on July 16, 2024

Oh wait, you are right, I misremembered that. There is indeed no shared wait! So it actually needs to be turned around to work and the waiting thread needs to create the event. I'm not quite sure whether this is something that can be improved without introducing additional locking within the driver, which would certainly impair performance.

from eventcore.

yellowsink avatar yellowsink commented on July 16, 2024

I can probably work around this in my wrapper struct I have - I can keep a map of thread ids to (eventid, shared(eventdriver)) and that should work, but I suppose if making this work would result in a general slowdown for usage of events in eventcore its most likely better placed as a hit taken in user code than there.

from eventcore.

yellowsink avatar yellowsink commented on July 16, 2024

I can probably work around this in my wrapper struct I have

I've got this working - so I suppose it's really just a docs change that's needed to clarify the requirement to wait on the same thread as create

from eventcore.

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.