aardio 文档
aardio 范例: 对称式协程
//对称式协程
import console;
import coroutine;
class 公司 {
ctor(){
var coroutine = ..coroutine;
this.客服 = coroutine.create(
function(工单){
while(工单){
工单 = coroutine.transfer(this.用户,"已解决," + 工单)
}
coroutine.transfer( ,"老板,累得不如狗,给加班费不?!")
}
)
this.用户 = coroutine.create(
function(消息){
for(i=1;100;1){
..console.log( coroutine.transfer(this.客服,"工单号:" + i) );
}
coroutine.transfer(this.客服)
}
)
..console.log( coroutine.transfer( this.用户,"欢迎光临,有任何问题请联系客服") );
}
}
coroutine.run(公司)
console.pause();
Markdown 格式