Re: gettimeofday cause crash on Windows

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: gettimeofday cause crash on Windows
Дата
Msg-id 20150212151403.GJ3391@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: gettimeofday cause crash on Windows  (Asif Naeem <anaeem.it@gmail.com>)
Ответы Re: gettimeofday cause crash on Windows
Re: gettimeofday cause crash on Windows
Список pgsql-bugs
Asif Naeem wrote:
> Don’t you feel gettimeofday() implementation is incomplete in current
> state, Is there any other example of function port in PG that could lead to
> crash if its related init_* function is not called earlier ?. As mentioned
> by Michael, it seems not enough documented (release notes etc), at least it
> need to give warning etc instead of simply crash the related process.
> GetSystemTimeAsFileTime() function is less precise but it is quite fast and
> less CPU intensive then GetSystemTimePreciseAsFileTime() function,
> GetSystemTimePreciseAsFileTime() can effect performance of an application.
> With the proposed patch, gettimeofday() function is more safe and more
> versatile, a contrib may use it as per its need of precision. Thanks.

Ideally we would the Precise dance automatically, without requiring the
program to call an initialization function.  Otherwise, programs may
never be updated to use Precise rather than the stock function.  I guess
this is the reason Andres prefers a crash: to force programs to be
updated to include the initialization step.

I wonder if it would work to set the function initially to the
initialization function, so that on the first call the Precise version,
if it exists, is detected (or the stock version otherwise) and set as
the function to call for later -- without requiring a jump in every
subsequent execution of gettimeofday(), of course.  The initialization
function itself would have to return the value returned by
GetSystemTimePreciseAsFileTime, of course.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Asif Naeem
Дата:
Сообщение: Re: gettimeofday cause crash on Windows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: gettimeofday cause crash on Windows