1234567891011121314151617181920212223242526272829303132 |
- import std.stdio;
- import core.thread : Fiber;
- void foo(){
- writeln("Hello");
- Fiber.yield();
- writeln("World");
- }
- void test5_spawner(){
- auto f = new Fiber(&foo);
- //f.call(); // Hello
- //f.call(); // World
-
- while(f.state != Fiber.State.TERM){
- f.call();
- }
- }
- /*
- ./vtest2
- hello here!
- Hello
- World
- */
|