Comments (6)
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.
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.
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.
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.
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.
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)
- Is EINTR handled on POSIX? HOT 1
- Release v0.8.49 broke dlang's Buildkite CI HOT 2
- What's the validation counter used for?
- dub produces error on FreeBSD 12.1-RELEASE-p10 HOT 2
- code duplication within version block below. HOT 2
- Do not call `AA.remove` from finalizer HOT 4
- Timer callback resets on every firing and should be rearmed to continue HOT 1
- What EventDrive* should I use to react to WinAPI gui messages? HOT 8
- Use io_uring where sensible HOT 1
- Possible s_driver leaking path HOT 4
- Creating and waiting on timers causes GC allocation every time - expected?
- Issue with installing vibe.d on android for termux HOT 2
- Implement support for DNS resolution via `org.freedesktop.resolve1`
- Building eventcore failing on FreeBSD 13.0-RELEASE
- waitForData is not implemented for Windows
- About io_uring support ;)
- Support scatter write / gather read HOT 1
- WinAPIEventDriverSockets.cancelRead closes connection
- MsgWaitForMultipleObjectsEx wake mask HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eventcore.