Use nanosleep() for pg_usleep() on Unix/Linux?

Поиск
Список
Период
Сортировка
От Paul Guo
Тема Use nanosleep() for pg_usleep() on Unix/Linux?
Дата
Msg-id CABQrizfxpBLZT5mZeE0js5oCh1tqEWvcGF3vMRCv5P-RwUY5dQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Use nanosleep() for pg_usleep() on Unix/Linux?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I happened to read the pg_usleep() code recently. I'm wondering
if we could implement it using the posix function nanosleep(),
instead of by select().

nanosleep() is designed with higher time resolution, besides it provide
remaining time if is interrupted by signal so that pg_usleep() could
be implemented more accurately.

The code for pg_usleep() could be similar like this:

while(nanosleep(&req,&req)==-1 && errno == EINTR)

  continue;


or combine with clock_gettime() to control the sleep time more accurately.


Regards,

Paul

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

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: Write Ahead Logging for Hash Indexes
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Override compile time log levels of specific messages/modules