[Interest] proper (silent) exit in response to SIGHUP?

Thiago Macieira thiago.macieira at intel.com
Mon Oct 15 20:11:05 CEST 2018


On Monday, 15 October 2018 09:22:27 PDT René J. V. Bertin wrote:
> Thiago Macieira wrote:
> > I wasn't joking. The Unix systems often copy neat features from one
> > another
> > when one innovates ahead of the others. I have a pending patch for Linux
> > copying OpenBSD's O_NOSIGPIPE option but I have yet to finish it.
> 
> So you meant "ask to incorporate this here implementation". That might work
> for Linux, possibly (Free)BSD which are open source ... but I wouldn't keep
> my hopes up with the likes of Apple.

Indeed, so you get to pay the price for the OS not providing state-of-the-art 
solutions: two file descriptors per thread instead of just one.

Don't complain to us about this. Complain to the vendor who can't adopt 11-
year-old solutions.

> > QEventDispatcherCoreFoundation. But looking at the sources, it seems that
> > the event dispatcher is created on-demand by the first QEventLoop or by
> > calling exec(), so the file descriptor won't be opened until then.
> 
> So I wasn't completely blind - a thread that just lives its own life and
> doesn't interact with others through Qt mechanism could do without the
> pipes, but how much other overhead?

The cost of a thread is much higher than the cost of a file descriptor, at 
least in the kernel side and in pthread itself. I recommend you read your OS 
sources for pthread to see if it opens file descriptors anyway -- it might, in 
order to signal a few things.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list