Implement async/await using Fiber
Yuxuan Shui via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 19 12:57:11 PDT 2016
I find this difficult because I can't passing data via
Fiber.yield/Fiber.call pair. e.g. I want something like:
void fiberFunc() {
//Add some file descriptor to main loop
string y = Fiber.yield();
writeln(y);
}
auto f = new Fiber(&fiberFunc);
f.call();
mainloop {
if (fd_readable)
f.call(fd.rawRead());
}
I can probably using a derived fiber class and pass the result
via class members, but that seems clumsy and not very general.
Any ideas?
More information about the Digitalmars-d-learn
mailing list