Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5 - Mailing list pgsql-hackers

From Manfred Spraul
Subject Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5
Date
Msg-id 3FA80502.4000905@colorfullife.com
Whole thread Raw
In response to Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

>Manfred Spraul <manfred@colorfullife.com> 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



pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Open Sourcing pgManage
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Open Sourcing pgManage