Tom Lane wrote:

Manfred Spraul <[EMAIL PROTECTED]> writes:


For multithreaded apps, this is not possible: sigaction is per process.
Thus the calling application must handle the SIGPIPE signals for libpq - either by blocking or ignoring them. We are still discussing the exact API. Probably a global state that is accessible through a new function.



I think we should also take a hard look at avoiding the problem by using MSG_NOSIGNAL on platforms that have it,

I think that's the second step. First we need a portable solution, then we can optimize it.
The fastest solution is one signal(SIGPIPE, SIG_IGN) in main(), but that requires a change in all libpq users. OTHO there shouldn't be that many multithreaded users.
sigprocmask + sigwait could work, but sigprocmask is undefined if multiple threads are running. Is there a portable approach for weak links? libpq would have to call proc_sigmask if linked against libpthread, and sigprocmask if not linked against libpthread. With gcc, I could use 'void proc_sigmask () __attribute__ ((weak, alias ("_sigprocmask")));' or something similar, but this wouldn't be portable either.


--
   Manfred


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to