如何创建非阻塞异步函数?以下是我想要实现的,但我的程序仍在阻止......
var sys = require("sys");
function doSomething() {
sys.puts("why does this block?");
while(true);
}
setTimeout(doSomething,0);
setTimeout(doSomething,0);
setTimeout(doSomething,0);
sys.puts("main");
Run Code Online (Sandbox Code Playgroud) node.js ×1