Re: Can't remove a call_out.

Arne Goedeke <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Interestingly, having two local variables f1 and f2 in check_timeout
both initialized to do_timeout do compare equal but dont have the same
hash_value. That might be a reason why remove_call_out cannot find them.

arne

On 10/24/14 10:25, Stefan Gluszek wrote:
> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.