Re: libpq thread-locking

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: libpq thread-locking
Date: 2008-05-08 18:07:22
Message-ID: 200805081807.m48I7Mr25934@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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)

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-05-08 18:09:21 Re: libpq thread-locking
Previous Message Josh Berkus 2008-05-08 17:43:54 Re: Posting to hackers and patches lists