[Development] Using platform-native APIs for terminating QThreads
Thiago Macieira
thiago.macieira at intel.com
Tue Sep 6 01:53:44 CEST 2016
Em segunda-feira, 5 de setembro de 2016, às 18:46:41 PDT, Giuseppe D'Angelo
escreveu:
> Il 05/09/2016 17:04, Alexander Nassian ha scritto:
> > Is, or should, that even be supported? I’m just wondering because when
> > I’m using Qt to create a thread, I also use Qt to quit it. Why should
> > anybody use a „foreign“ API?
>
> Maybe one is just using a 3rd party library that assumes pthreads, not Qt.
>
> Again, this is not the point, the point is that this used to work (users
> relying on undocumented behaviour) and I was about to break that
> behaviour. I wanted consensus before proceeding.
Note one more wrinkle in this: we never promised that pthread_exit(), in
specific, would work. However, the fact that QThreadPrivate::finish is run by
way of a cleanup function is indicative that someone in the past tried and
QThread was changed to support cancellation.
It's more likely that it was inserted so that QThread::terminate would emit
the termination signals.
Which in turn brings about *another* wrinkle: if we don't add the workaround,
thr->terminate() will terminate the entire application. That's not acceptable.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list