Review Request: Do not terminate threads

Albert Astals Cid tsdgeos at terra.es
Mon Aug 15 00:05:41 BST 2011



> On Aug. 12, 2011, 3:45 a.m., Dawit Alemayehu wrote:
> > #1. Doesn't this approach have similar issues to the one that forced me to change the previous QtConcurrent::run based implementation ? That is, doesn't the use of a single thread expose this function to lookup requests backlog and hence cause noticable delays ?
> > 
> > #2. Isn't all this complexity a bit too much for such a small functionality ? Wouldn't a much simpler approach work just as well ? For example,
> > 
> > - Keep the current look up thread, but connect its finished signal to its parent deleteLater signal in its ctor. [Automatic cleanup of the lookup thread].
> > - Make the lookup thread cache the looked up information in the global cache instead of storing it locally. [No need to store this inform 2x].
> > - Move all the preemtive lookup logic from the thread's run function to HostInfo::lookupHost. [No need to create a thread when DNS is already cached].
> > - Create the lookup thread on the heap and let it run until it finishes. When it is done it will clean itself up.
> >   
> > See a patch that implements the above approach at https://git.reviewboard.kde.org/r/102238/
> >

#1 Each request itself is threaded and non blocking, so i don't see why multiple request  should cause delays

#2 Your patch has several issues i mentioned there


- Albert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102179/#review5654
-----------------------------------------------------------


On Aug. 11, 2011, 10:10 p.m., Albert Astals Cid wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102179/
> -----------------------------------------------------------
> 
> (Updated Aug. 11, 2011, 10:10 p.m.)
> 
> 
> Review request for kdelibs and Dawit Alemayehu.
> 
> 
> Summary
> -------
> 
> Each time the terminate code triggers my Konqueror crashes, i'm substituting the terminate for just waiting the thread to finish and we just ignoring it.
> 
> The code has a race condition in which wait() returns false, then we switch to the thread and m_autoDelete is still not set and thus noone will delete the thread. I can add a mutex if you guys think this is unacceptable.
> 
> 
> Diffs
> -----
> 
>   kio/kio/hostinfo.cpp 344b1d8 
> 
> Diff: http://git.reviewboard.kde.org/r/102179/diff
> 
> 
> Testing
> -------
> 
> When the 
> kDebug() << "Name look up for" << hostName << "failed";
> if triggers i do not get a crash anymore.
> 
> 
> Thanks,
> 
> Albert
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110814/5561e630/attachment.htm>


More information about the kde-core-devel mailing list