0
據我所知yield
是像return
工作,但沒有打破執行功能。爲什麼在函數中調用yield會導致訪問衝突?
這是我的代碼:
import std.stdio;
import core.thread;
void main()
{
writeln("1");
foo();
writeln("2");
}
void foo()
{
writeln("Hello");
Fiber.yield();
writeln("world");
}
輸出:
> app.exe
1
Hello
[email protected](0): Access Violation