ThreadWeaver and asyncronous operations

Mirko Boehm mirko at kde.org
Wed Mar 28 08:25:40 BST 2007


Hi Paulo,

the reason is: 

* you create the job in your main thread
* this creates the timer in the main thread

then the job is executed in one of the threads of threadweavers pool

* this makes the QTimer think it still resides in the main thread, thus the 
error message
* you need to create the timer once the job is executed, within the run 
function, then it knows about its correct thread

The main difference between just using threads and using threadweaver is that 
you do not own the thread, so you cannot moveToThread() the QObjects you 
created. 

--Mirko.
On Wednesday 28 March 2007 02:29, you wrote:
> This works.
>
> The only problem I noticed is that if the AsyncObject internals use timers,
> for example, I get the "QObject::startTimer: timers cannot be started from
> another thread" message.
> I don't understand this however, because the timers are ran in the same
> thread as the AsyncObject.
>
> If someone shed a light on this I would really appreciate.
>
> Paulo

-- 
KDE e.V.: http://ev.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070328/cc36e275/attachment.sig>


More information about the kde-core-devel mailing list