pg_usleep

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: pg_usleep
Date: 2003-12-30 18:58:53
Message-ID: 3FF1CAED.7080504@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Tom Lane wrote:

>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.
>
>
>
patch + new file attached. Haven't tested on Windows, but should be fine.

cheers

andrew

Attachment Content-Type Size
pg_usleep.c text/plain 755 bytes
usleep.patch text/plain 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-12-30 19:00:48 Re: Is my MySQL Gaining ?
Previous Message Jason Godden 2003-12-30 18:57:36 Re: Improving/Adding to Docs (was Is my MySQL Gaining ? or someone missed a date with a dolphin)

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Claudio Natoli 2003-12-31 02:33:09 Re: pg_usleep
Previous Message Tom Lane 2003-12-30 16:51:41 Re: select() for small sleep

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-12-30 23:12:35 Solaris thread patch
Previous Message Tom Lane 2003-12-30 17:16:15 Re: [PATCHES] update i386 spinlock for hyperthreading