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

Sérgio Martins sergio.martins at kdab.com
Mon Oct 15 19:24:49 CEST 2018


On 2018-10-15 16:59, Thiago Macieira wrote:
> On Monday, 15 October 2018 06:34:55 PDT René J. V. Bertin wrote:
>> Thiago Macieira wrote:
>> > Do you realise that the cost of starting a thread is much higher than the
>> > cost of a pipe? Not to mention that using QThread will create a pipe
>> > anyway, so you'd need to drop down to low-level primitives (pthread,
>> > Win32) to get away from it.
>> 
>> OK, that's an argument. I tried to figure that out and didn't see 
>> evidence
>> that QThread *always* creates a pipe. Pity but thanks for confirming.
> 
> It's not QThread itself, it's the event dispatcher. Either
> QEventDispatcherUNIX, QEventDispatcherGlib or, on a Mac,
> 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.


It will be created regardless of event loop:

https://code.woboq.org/qt5/qtbase/src/corelib/thread/qthread_unix.cpp.html#342


-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts



More information about the Interest mailing list