Re: libpq thread-locking - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: libpq thread-locking
Date
Msg-id 20080516160438.5dc59e0c@mha-laptop.hagander.net
Whole thread Raw
In response to Re: libpq thread-locking  (Bruce Momjian <bruce@momjian.us>)
Responses Re: libpq thread-locking
Re: libpq thread-locking
List pgsql-patches
Bruce Momjian wrote:
> Bruce Momjian wrote:
> > Magnus Hagander wrote:
> > > Attached patch adds some error checking to the thread locking
> > > stuff in libpq. Previously, if thread locking failed for some
> > > reason, we would just fall through and do things without locking.
> > > This patch makes us abort() instead. It's not the greatest thing
> > > probably, but our API doesn't let us pass back return values...
> >
> > I have looked over the patch and it seems fine, though I am
> > concerned about the abort() case with no output.  I realize stderr
> > might be going nowhere, but in fe-print.c we do an fprintf(stderr)
> > for memory failures so for consistency I think we should do the
> > same here.  If there is concern about code bloat, I suggest a macro
> > at the top of the file for thread failure exits:
> >
> >     #define THEAD_FAILURE(str) \
> >     do { \
> >         fprintf(stderr, libpq_gettext("Thread failure:
> > %s\n")); \ exit(1); \
> >     } while(0)
>
> Oh, this is Tom saying he doesn't like stderr and the added code lines
> for failure:
>
>     http://archives.postgresql.org/pgsql-patches/2008-04/msg00254.php
>
> I think the macro and consistency suggest doing as I outlined.

Does this one look like what you're suggesting?

//Magnus

Attachment

pgsql-patches by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: libpq object hooks
Next
From: Andrew Chernow
Date:
Subject: Re: libpq thread-locking