From: | Manfred Spraul <manfred(at)colorfullife(dot)com> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | PQinSend question |
Date: | 2004-01-11 15:34:34 |
Message-ID: | 40016D0A.9030906@colorfullife.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
From fe-secure.c:
> /*
> * Indicates whether the current thread is in send()
> * For use by SIGPIPE signal handlers; they should
> * ignore SIGPIPE when libpq is in send(). This means
> * that the backend has died unexpectedly.
> */
> pqbool
> PQinSend(void)
> {
> #ifdef ENABLE_THREAD_SAFETY
> return (pthread_getspecific(thread_in_send) /* has it been
> set? */ &&
> *(char *)pthread_getspecific(thread_in_send)
> == 't') ? true : false;
> #else
> return false; /* No threading, so we can't be in send() */
Why not? Signal delivery can interrupt send() even with single-threaded
users.
I really like the openssl interface: what about something like
typedef void (*pgsigpipehandler_t)(bool enable);
void PQregisterSignalCallback(pgsigpipehandler_t new);
The callback is global, and called around the send() calls.
The default handler uses the sigaction code from 7.4. The current
autodetection code is less flexible than a callback, and it's not 100%
backward compatible.
--
Manfred
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Cave-Ayland | 2004-01-11 16:05:05 | Suggestions for analyze patch required... |
Previous Message | Manfred Spraul | 2004-01-11 14:10:23 | libpq thread safety |