test5.d 507 B

12345678910111213141516171819202122232425262728293031323334353637
  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. while(f.state != Fiber.State.TERM){
  17. f.call();
  18. }
  19. }
  20. /*
  21. ./vtest2
  22. hello here!
  23. Hello
  24. World
  25. */