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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>, Joe Conway <mail(at)joeconway(dot)com>, Denis A Ustimenko <denis(at)oldham(dot)ru>
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date: 2002-10-14 18:42:47
Message-ID: 18374.1034620967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David De Graff 2002-10-14 18:57:06 Postgres-based system to run .org?
Previous Message Tom Lane 2002-10-14 18:35:14 Final(?) consensus on PQcmdStatus and rules