test5.d 444 B

123456789101112131415161718192021222324252627282930313233
  1. // todo test
  2. // https://chat.qwen.ai/c/b2eea389-4859-4467-aa24-85e189a4557e
  3. // https://chat.qwen.ai/c/5cfd2bc3-66eb-4ca5-a2cd-7126e99e4dc4
  4. // https://vibed.org/api/vibe.core.channel/
  5. import std.stdio;
  6. import core.thread : Fiber;
  7. void foo(){
  8. writeln("Hello");
  9. Fiber.yield();
  10. writeln("World");
  11. }
  12. void test5_spawner(){
  13. auto f = new Fiber(&foo);
  14. f.call(); // Hello
  15. f.call(); // World
  16. }
  17. /*
  18. ./vtest2
  19. hello here!
  20. Hello
  21. World
  22. */