[sane-devel] Re: Need help porting sanei/sanei_thread.c (Rene W. Olsen)

François Revol revol at free.fr
Thu Sep 8 15:34:02 UTC 2005


> Date: Thu, 08 Sep 2005 03:37:13 +0100
> From: "Rene W. Olsen" <ac at rebels.com>
> 

If SIGPIPE doesn't exist there is no reason to touch its handler :)

How about...

static void
restore_sigpipe( void )
{
#ifdef SIGPIPE
    struct sigaction act;

    if( sigaction( SIGPIPE, NULL, &act ) == 0 ) {

        if( act.sa_handler == SIG_IGN ) {
            sigemptyset( &act.sa_mask );
            act.sa_flags   = 0;
            act.sa_handler = SIG_DFL;
            
            DBG( 2, "restoring SIGPIPE to SIG_DFL\n" );
            sigaction( SIGPIPE, &act, NULL );
        }
    }
#endif
}

Actually I wonder why it's just not 

static void
restore_sigpipe( void )
{
	signal(SIGPIPE, SIG_DFL);
}

There is no reason to use sigaction only for this.

> Any hint were to find some info on sigaction is welcome :D

man?
google?
http://www.opengroup.org/onlinepubs/007908799/xsh/sigaction.html


> Next problem is `pthread_kill' what do I do when the Amiga port of
> PThread dosent support that function?

in configure.in, add an
AC_CHECK_FUNC(pthread_kill)

then

#ifdef HAVE_PTHREAD_KILL
    pthread_kill(...);
#endif

though it's probably not a good idea if you unload a sane backend with 
a thread still running code from it...

How about fixing your pthread port ?
I know our BeOS port is unfinished either, but I did native replacement 
code for this.


François.




More information about the sane-devel mailing list