|
Boost : |
From: Oliver.Kowalke_at_[hidden]
Date: 2005-12-13 01:42:03
>Hi Jeremy,
>Unfortunately this flag doesn't seem to be available on Solaris, which
>does raise SIGPIPE too. It also doesn't work with writev.
I use this code:
...
sig::action sa;
sa.set_handler( SIG_IGN);
sig::action old_sa( sa.run( SIGPIPE) );
boost::shared_ptr< void > guard(
static_cast< void * >( 0),
boost::bind(
& sig::action::run,
old_sa,
SIGPIPE) );
::write(...)
...
sig:action abstracts struct sigaction, clib function ::sigaction and so
on.
After sa.run( SIGPIPE) the signal is ignored and write would return
EPIPE. The shared_ptr resets the original signal handler after getting
out of scope.
Oliver
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk