Thanks for the info


~~Scott



-------- Original message --------
From: Thiago Macieira <thiago.macie...@intel.com>
Date: 1/5/22 4:31 AM (GMT-08:00)
To: interest@qt-project.org
Cc: Scott Bloom <sc...@towel42.com>
Subject: Re: [Interest] Qthread from QFuture?

On Tuesday, 4 January 2022 22:01:20 -03 Scott Bloom wrote:
> I appreciate the information.  However, I don’t understand why a QFuture
> created by QtConcurrent::run, if it can tell isRunning, why it cant return
> the QThread its using?

Because you don't have a use-case for using that pointer. What are you going
to do with it, since you don't own that thread? First of all, it's also a race
condition: the pointer may no longer be valid by the next instruction that you
run.

It belongs to the thread pool you started the job on, and the thread pool may
have more jobs to run. Obviously, the code that started that thread and is
running jobs expects the job to cleanly exit (via exceptions or return, but
still cleanly) so it can do its post-job maintenance on the thread and the job
count. If you killed the thread, that thing will go completely out of sync and
may crash or deadlock even harder.

> Unless there is simply no QThread, and its using all OS calls (which could
> make sense).

No, it's using QThread.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to