Howdy,

I'm trying to introduce a change [1] which will make QThread invoke
std::terminate in case an exception is thrown from the new thread
(including, but not limited to: user's reimplementation of QThread::run;
slots listening to the QThread::started / finished signals; custom event
dispatchers).

The idea is to align ourselves to what std::thread does.

There's a small catch, however: user code might be using platform-native
APIs such as pthread_exit(3) in order to make a QThread quit.

On some implementations (notably: glibc), pthread_exit is implemented by
throwing an exception, because it needs to run the pushed cleanup
handlers. The net result is that, with my change applied, pthread_exit
won't make the thread exit but crash the application instead (!).

The question for the ML is: is this a scenario Qt has ever officially
supported, and a scenario that we should support in the future?

(QThread documentation does not talk about how QThread itself is
implemented, so actually relying on the that it has pthread semantics is
already a slight API abuse by the users).

[1] https://codereview.qt-project.org/#/c/167240/

Cheers,
-- 
Giuseppe D'Angelo | [email protected] | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - The Qt Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to