nanogui: Thread: GdTimeout bug


[<<] [<] Page 1 of 1 [>] [>>]
Subject: GdTimeout bug
From: "David Erickson" ####@####.####
Date: 24 Oct 2001 19:15:31 -0000
Message-Id: <200110241915.MAA06106@mon-irva-11.broadcom.com>

I think there's a bug in GdTimeout, found in engine/devtimer.c. Here's the 
fixed version:

MWBOOL GdTimeout(void)
{
    MWTIMER *n, *t = timerlist;

    gettimeofday(&current_time, NULL);

    while(t) {
        n = t->next;
        if(time_to_expiry(&t->timeout) <= 0) {
            t->callback(t->arg);
            GdDestroyTimer(t);
        }
        t = n;
    }

//DME: fixed bug. added check of tv_usec as well
    if(mainloop_timeout.tv_sec > 0 || mainloop_timeout.tv_usec > 0)
        if(time_to_expiry(&mainloop_timeout) <= 0)
            return TRUE;

    return FALSE;
}



I was using GrGetNextEventTimeout, with a timeout value under 1 second. 
GdTimeout() was returning false when called from GsSelect(). I think this is 
because the test of mainloop_timeout was only checking tv_sec and not tv_usec 
as well.

-- 
David Erickson
Senior Staff Software Engineer
Broadcom Corporation
949-585-5875

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.