Can't remove a call_out.
Stefan Gluszek <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CABER6e6Ri7iZWpHrfWbafF7d6+v5=x1pWow7TWA+QgVnDBhERw@mail.gmail.com> |
Seems like a bug, I can't remove a call_out by function name right after
scheduling it.
void test()
{
bool testvar = false;
void do_timeout()
{
testvar = true;
};
void check_timeout()
{
mixed a = call_out( do_timeout, 20);
werror("a: %O\n", a);
werror("check_timeout(): %O\n", remove_call_out( do_timeout ));
werror("check_timeout(): %O\n", remove_call_out( a ));
};
check_timeout();
}
int main(){
call_out(test, 0);
return -1;
}
I am able to remove it by the call out id returned from call_out. Also I am
able to remove the call out if I remove the testvar variable or move it
into the global scope.
So this works:
void test()
{
void do_timeout()
{
werror("to\n");
};
void check_timeout()
{
mixed a = call_out( do_timeout, 20);
werror("a: %O\n", a);
werror("check_timeout(): %O\n", remove_call_out( do_timeout ));
werror("check_timeout(): %O\n", remove_call_out( a ));
};
check_timeout();
}
int main(){
call_out(test, 0);
return -1;
}
Stefan