[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: mcop's SIG_PIPE handler
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2001-08-22 19:10:33
[Download RAW message or body]

   Hi!

On Mon, Aug 20, 2001 at 11:27:08PM +0100, Rik Hemsley wrote:
> mcop warning: user defined signal handler found for SIG_PIPE, overriding
> 
> What's this all about then ? :)
> 
> My app has nothing to do with aRts really, it just happens that it
> uses libao, a C library which does audio output. libao dlopens
> libartsc.
> 
> It looks like aRts is trying to override my signal handler. That's
> not friendly behaviour :(

Yes, thats why I put the warning there. It gave me a headache the day I wrote
these lines already. It's in kdelibs/arts/mcop/dispatcher.cc line 214. It's
there because if it wouldn't be there, then killing away one program which
uses MCOP might crash other programs using MCOP due to unhandled SIGPIPE
signals, i.e.

 * killing noatun could crash artsd
 * killing artsd could crash noatun

I am not quite sure if there is a better way. I have looked at the esd source,
and it appears to encapsulate write calls individually, like this (esdlib.c):

/* this is unavoidable - incase ESD "disappears" (ie the socket conn dies) */
/* we need to catch SIGPIPE to avoid the default handler form giving us */
/* a bad day - ignore the SIGPIPE, then make sure to catch all errors */

    phandler = signal( SIGPIPE, dummy_signal );    /* for closed esd conns */
    /* send the necessary information */
    if ( write( esd, &proto, sizeof(proto) ) != sizeof(proto) ) {
        signal( SIGPIPE, phandler );
        return -1;
    }
 
    /* return the sample id to the client */
    signal( SIGPIPE, phandler );

but that sounds terrible to me, too. One thing is that I could imagine that
it could have quite a bit impact on the performance, another thing is that
I am not sure what happens if you have a multithreaded program. Couldn't you
run into race conditions that way?

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic