-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TaggedUnion assert failure when waiting an event from a different thread #238
Comments
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! |
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 |
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? |
Oh wait, you are right, I misremembered that. There is indeed no |
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. |
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 |
When attempting to wait for an event created on the main thread from a second thread (as far as I can tell from the documentation, that is allowed), the wait() call (not even processevents!) causes an assertion failure in taggedunion.
I've attached a minimal reproduction, but for reference, I encountered this within a more complex project with this demo code: https://github.com/yellowsink/rockhopper/blob/ed05a03/source/app.d
Minimal reproduction code:
library versions:
exception message (DMD, LDC gives a more compact stack trace):
The text was updated successfully, but these errors were encountered: