void OnMove(){
if (!microthread_.isEnd()){
if (!microthread_.isSuspended()) {
smart_ptr<function_callback> fn(function_callback_v::Create(&CCharacter2::microthread));
microthread_.start(fn);
} else {
microthread_.resume();
}
}
}
void MainThread(){
int i,x=100,y=200;
for(i=0;i<100;++i) { x+=2; suspend(); }
for(i=0;i<100;++i) { y+=2; suspend(); }
}
void suspend() { microthread_.suspend(); }
|