[Verse-dev] Timing problem on Mac OS X

Emil Brink emil at obsession.se
Mon Feb 14 14:50:50 CET 2005


Eskil,

I've been looking into Verse on Mac OS X, since new coworker
Camilla reported problems.

Not sure if I've really found the root cause yet, but I do
have at least one suspect. This code, in the main input loop
of verse_callback_update():

for(passed = 0; passed <= microseconds && VConData.pending_packets == 0;
    passed += V_CON_MAX_MICROSECOND_BETWEEN_SENDS)
{
        if(V_CON_MAX_MICROSECOND_BETWEEN_SENDS < microseconds - passed)
                v_n_wait_for_incoming(V_CON_MAX_MICROSECOND_BETWEEN_SENDS);
        else
                v_n_wait_for_incoming(microseconds - passed);
        v_con_network_listen();
        connection = VConData.current_connection;
        for(VConData.current_connection = 0; VConData.current_connection < VConData.con_count; VConData.current_connection++)
                v_noq_send_queue(VConData.con[VConData.current_connection].out_queue, &VConData.con[VConData.current_connection].network_a\
ddress);
        VConData.current_connection = connection;
}

runs very badly on Mac OS X. It *seems* to be the case that a call
to v_n_wait_for_incoming() always takes on the order of 10 ms, but
the value of V_CON_MAX_MICROSECOND_BETWEEN_SENDS is 1000, i.e. 1 ms.

The loop above blindly assumes that wait_for_incoming() always does
the right thing, and doesn't in fact *measure* the time spent, so
it's fooled and things take too long time.

Not sure why spending too long listening to inputs should lead to
dropped packets (the problem we're seeing), though...

Eskil: have you run R4 on Mac OS X successfully?

/Emil




More information about the Verse-dev mailing list