Re: pg_arch.c call to sleep()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_arch.c call to sleep()
Date: 2004-11-07 20:15:12
Message-ID: 200411072015.iA7KFCR10464@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > We have the following warning on Windows:
> > pgarch.c:349: warning: implicit declaration of function `sleep'
>
> > To fix it we could include the right header (which appears to be
> > <stdlib.h> in the Windows/Mingw case), or we could replace the call by a
> > call to pg_usleep().
>
> <stdlib.h> is included automatically by c.h, so that surely won't fix it.
>
> I have some recollection that we invented pg_usleep in part because we
> wanted to not use sleep() at all in the backend, but I don't recall why
> (and the reasoning might not apply to the archiver process, anyway).

I think usleep was so we could accept signals during the sleep.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-11-07 20:20:26 pg_resetxlog options
Previous Message Bruce Momjian 2004-11-07 20:13:32 Re: cygwin build failure