Hi,
is there a way to communicate with a task that is spawned in a working thread with runWorkerTask()?
In general, is there a way to send messages to a task running in a different event loop?
Since runWorkerTask does not return a Task object I cannot use send/receive, and I cannot pass an explicit MessageQueue as an argument to the function since it is not isolated.
I also tried doing something like:
ManualEvent e = createManualEvent();
runWorkerTask(function void(ManualEvent e) {
scope (exit) e.emit();
// do something synchronous
}, e);
e.wait();
But compilation fails with the rather unhelpful message.
Running dmd...
FAIL ../../vibe.d/.dub/build/libevent-debug-linux.posix-x86_64-dmd-AB0707232CA963B5DA23C2232BBED51B vibe-d staticLibrary
Error executing command build: DMD compile run failed with exit code -9
and still, it would allow me just to wait for the worker task to finish, not to retrieve data from it.
Am I missing something?
Something like this for instance would be helpful in ThreadedFileStream, not to block the main event loop when doing file I/O.