[DGD] A call_out problem

Aki J Kotala kotala at cs.Helsinki.FI
Sun Apr 14 15:28:34 CEST 2002


Hello,

Call_out handles are not working quite orderly for me.  Here's a program
that demonstrates what I'm trying.

The expected result is that call_fun1() gets called every five seconds,
and call_fun2() once per second.  What actually happens is that after
the first five seconds, only call_fun1() is ever called.  However if
I #define WAIT as 0, it works fine.  It looks as though the two call_outs
for some reason get a duplicate handle.

I'm using 1.2p1, by the way.


(code begins)


#define DEBUG(x) this_user()->message(x + "\n")
#define WAIT 1

int handle1, handle2;
int wait;

void call_fun1();
void call_fun2();


void begin()
{
    wait = 0;

    call_fun1();
    call_fun2();
}


void call_fun1()
{
    DEBUG("call_fun1()");

    if (wait >= WAIT) {
        call_fun2();
    }

    ++wait;

    remove_call_out(handle1);
    handle1 = call_out("call_fun1", 5);
}

void call_fun2()
{
    DEBUG("call_fun2()");

    remove_call_out(handle2);
    handle2 = call_out("call_fun2", 1);

    if (handle1 == handle2) {
        DEBUG("call_out handles are the same, worry.");
    } else {
        DEBUG("Everything is okay.");
    }
}

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list