Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date
Msg-id 200210142241.g9EMfRY27876@candle.pha.pa.us
Whole thread Raw
In response to Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >               /*
> >                *     select() may modify timeout argument on some platforms so
> > !              *    use copy.
> > !              *    XXX Do we really want to do that?  If select() returns
> > !              *    the number of seconds remaining, we are resetting
> > !              *    the timeout to its original value.  This will yeild
> > !              *    incorrect timings when select() is interrupted.
> > !              *    bjm 2002-10-14
> >                */
> >               tmp_timeout = *timeout;
> >               ptmp_timeout = &tmp_timeout;
> 
> 
> Actually, now that I look at this, the API for PQwaitTimed is wrong
> after all.  The right way to implement this is for the caller to pass in
> finish_time (or some indication that no timeout is wanted).  Evaluation
> of the time left to wait should happen inside this retry loop.  That
> way, you get the right behavior (plus or minus one second, anyway)
> independently of whether the platform's select() reduces its timeout
> argument or not.

Yes, you are saying do the time() inside PQwaitTimed(), so we can
properly get new time() values on select() retry.  Yep.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Postgres-based system to run .org registry?
Next
From: Bruce Momjian
Date:
Subject: Re: orderRules() now a bad idea?