Re: select() for small sleep

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: select() for small sleep
Date: 2003-12-30 16:51:41
Message-ID: 23636.1072803101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

  • pg_usleep at 2003-12-30 18:58:53 from Andrew Dunstan

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2003-12-30 16:55:43 Re: [PATCHES] update i386 spinlock for hyperthreading
Previous Message Bruce Momjian 2003-12-30 16:48:10 Re: [PATCHES] update i386 spinlock for hyperthreading

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Andrew Dunstan 2003-12-30 18:58:53 pg_usleep
Previous Message Andrew Dunstan 2003-12-30 15:37:36 select() for small sleep

Browse pgsql-patches by date

  From Date Subject
Next Message Jan Wieck 2003-12-30 16:55:43 Re: [PATCHES] update i386 spinlock for hyperthreading
Previous Message Bruce Momjian 2003-12-30 16:48:10 Re: [PATCHES] update i386 spinlock for hyperthreading