Re: [Interest] Threading Question

2014-10-11 Thread Constantin Makshin
You're right, but the original Jason's message contains this fragment: > Inside of BackgroundClass in the constructor, I start a QTimer that is > supposed to go off every 5minutes and call the runTasks function when it does. > QTimer* timer = new QTimer(this); So the timer is created on the heap

Re: [Interest] Threading Question

2014-10-10 Thread Alan Ezust
>From what I understand, moveToThread() requires a parent-child relationship between the objects for the "subtree" to include them. If the QTimer was a subobject (data member) rather than a pointer to another heap object with the parent set, then the QTimer won't be moved to the other thread along

Re: [Interest] Threading Question

2014-10-09 Thread Constantin Makshin
The description of QObject::moveToThread() says the whole object's "subtree" is moved, so that hypothesis doesn't sound very plausible. On Oct 9, 2014 3:06 PM, "Jason Kretzer" wrote: > Ack! You are correct. > > I guess I would do something like this to remedy that: > > in the main: > BackgroundT

Re: [Interest] Threading Question

2014-10-09 Thread Jason Kretzer
Ack! You are correct. I guess I would do something like this to remedy that: in the main: BackgroundTaskManager::init(); QThread *thread = new QThread(); connect(thread, SIGNAL(started()), BackgroundTaskManager::instance(), SLOT(startTimer())); BackgroundTaskManager::instance()->m

Re: [Interest] Threading Question

2014-10-09 Thread Reinhardt Behm
On Thursday 09 October 2014 03:32:20 Jason Kretzer wrote: > Thanks for the response. > > Yeah, I have placed qDebug() just before and just after the emit. The one > before always prints, the one after never does except in the following > case. If I change the connection to QueuedConnection, the

Re: [Interest] Threading Question

2014-10-09 Thread Jason Kretzer
Thanks for the response. Yeah, I have placed qDebug() just before and just after the emit. The one before always prints, the one after never does except in the following case. If I change the connection to QueuedConnection, then the qDebug right after does print, the rest of the function does

Re: [Interest] Threading Question

2014-10-08 Thread Tony Rietwyk
soft.com...@qt-project.org] On Behalf > Of Jason Kretzer > Sent: Thursday, 9 October 2014 2:43 PM > To: interest@qt-project.org > Subject: [Interest] Threading Question > > I am a bit confused on threading. > > Lets say I have Thread A - which is where the program is started - has

Re: [Interest] Threading Question

2014-10-08 Thread Constantin Makshin
Two suggestions: 1) add qDebug-s around the "emit someSignal();" line to see whether it returns or not, hanging somewhere in validateResult(); 2) try to explicitly specify the Qt::QueuedConnection type for the someSignal() connection — if it helps, then the [most likely] cause is Qt choosing wrong

Re: [Interest] Threading Question

2014-10-08 Thread Jason Kretzer
Addendum at the bottom… On Oct 8, 2014, at 11:42 PM, Jason Kretzer wrote: > I am a bit confused on threading. > > Lets say I have Thread A — which is where the program is started — has > main(), etc. > > Inside of main() I instantiate a class called BackgroundClass and I move it > to another

[Interest] Threading Question

2014-10-08 Thread Jason Kretzer
I am a bit confused on threading. Lets say I have Thread A — which is where the program is started — has main(), etc. Inside of main() I instantiate a class called BackgroundClass and I move it to another thread (Thread B). BackgroundClass::init(); QThread *thread = new QThread(