If you are looking for some explanation of the QThread and how to use them 
properly, here a few other links:

  1.  https://www.kdab.com/multithreading-with-qt/
  2.  http://blog.debao.me/2013/08/how-to-use-qthread-in-the-right-way-part-1/
  3.  http://blog.debao.me/2013/08/how-to-use-qthread-in-the-right-way-part-2/

The problems with QThread was the doc was lagging behind for a while (it's now 
fixed thanks to the people who updated it btw). Many people where using the 
QThread in a way that they where shooting themselves in the foot with the 
Thread affinity and the emit directly into the QThread object.
Since QThread is a QObject and it create the thread,  it doesn't itself reside 
into the created thread but in the thread that created the QThread object.

From: Interest <interest-boun...@qt-project.org> On Behalf Of David M. Cotter
Sent: May 19, 2020 7:11 PM
To: interest@qt-project.org
Subject: Re: [Interest] is it ok to push audio on a background thread, not a 
timer?

is it possible i'm just using QThread wrong?  and it HAPPENS to work fine on 
mac but fails on windows?

is this blogger really revealing the ONE TRUE NATURE of QThread:
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

?

-dave


On May 19, 2020, at 4:05 PM, David M. Cotter 
<d...@kjams.com<mailto:d...@kjams.com>> wrote:

anybody have any other ideas?


On May 18, 2020, at 9:12 PM, David M. Cotter 
<d...@kjams.com<mailto:d...@kjams.com>> wrote:

Note that you do initialise the i_auP pointer in your constructor's 
initialisation list
which is not a QObject, it's my own wrapper class
Irrelevant what it derives from
then i'm not understanding what your objection is.

i thought your objection was that objects derived from QObject, if they are 
used on a back thread then they must be either allocated there or "moved" there.

but since this i_auP is NOT a QObject, it's my own class, that i'm fine to 
allocate it in one thread (main) and then use it on another thread (audio pump 
thread) (provided and assuming i am careful to mutex any access from the main 
thread)


Are you saying that this calls a function that returned null?
sorry, what is "this" and what function are you referring to that returns null?

if you mean GetCUnit_Out() it returns an object of my own (not a QObject) that 
has already been allocated and is guaranteed to not be NULL


I repeat my request for a compileable example.
i hear you loud and clear but let's assume that's not happening for now and see 
how far we get




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

Reply via email to