Re: select() for small sleep

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: select() for small sleep
Дата
Msg-id 23636.1072803101@sss.pgh.pa.us
обсуждение исходный текст
Ответ на select() for small sleep  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> I wrote:
>> There are a couple of other places where [select()] is used for small 
>> sleeps (storage/lmgr/s_lock.c and access/transam/xact.c) -

> What is the preferred way to handle these 2 cases?  We could handle them 
> with #ifdef'd code inline, or create a new function pg_usleep(), or 
> possibly handle it with conditional macros inline. If a new function or 
> macro, where should they go?

I'd go with a new function.  There is no reason to try to "optimize"
this code by putting it inline; if you're trying to delay, another few
nanoseconds to enter a subroutine doesn't matter.

As for where, maybe make a new file in src/port/.  That would make it
relatively easy to use the same function in client-side code if we
needed to.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [PATCHES] update i386 spinlock for hyperthreading
Следующее
От: Manfred Spraul
Дата:
Сообщение: Re: [PATCHES] update i386 spinlock for hyperthreading