Asio has code to ignore SIGPIPE which is in Signal_init.hpp, however there is a macro warp it in io_service.hpp:
#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \
|| defined(__osf__)
I compile in Ubuntu found the macro doesn't enabled, so std::signal(Signal, SIG_IGN);
haven't been called.
However, when I write to an closed socket by asio, it can report EPIPE error by boost::system::error_code which in complete handler. According to libc doc:
In this case, send generates a SIGPIPE signal first; if that signal is ignored or blocked, or if its handler returns, then send fails with EPIPE.
How asio set with SIGPIPE let process to ignore it? Does asio do some special on this?