[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdecore/jobs (silent)
From:       Kevin Ottens <ervin () kde ! org>
Date:       2009-06-30 6:28:40
Message-ID: 200906300828.40531.ervin () kde ! org
[Download RAW message or body]


On Monday 29 June 2009 22:15:03 Ramon Zarazua wrote:
> Well here is the experience I had: What I gathered from the documentation
> is that start should call another worker method through the event loop.

Almost correct. The start() method triggers the start (sic!) of the job, be it 
through event loop, thread, external process.

KJob actually enforce nothing regarding the implementation. It's more or less 
an interface to plug the jobs in our infrastructures to track their 
progresses, etc. I adds to that a couple of conveniences to actually implement 
the jobs.

> I
> tried calling it with QTimer::singleShot, however I could not get it to
> work.

Well, what would be interesting is the why it didn't work out.

> For testing purposes I decided to call the worker method inside of
> start().

And that's wrong. Actually that's the only opportunity of docu clarification I 
see: put a big fat warning stating that the start() method is not the worker 
method and should be kept async (even if it was already written in the method 
apidox but less proeminently).

> Afterwards I realized that emitResult() was not instantly suiciding the job
> as I was led to believe.

Indeed, as the name implies it emits the result, and as the docu says it calls 
deleteLater(). No more and no less.

> I asked around a bit on kde-devel(mentioning that
> I could not get it to be called through the event loop), and I was told
> that it doesn't matter, and that return should be called.

Well yes, for a singleShot() based async worker method you've to return for it 
to give back control (see my remark on emitResult() above).

> If I was
> misinformed I apologize in advance, however that means that documentation
> is still not completely clear.

OK, so reverting your commit now, and providing the warning I mentionned above 
instead.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic