Fwd: Re: patch for kurlcompletion.cpp
Scott Wheeler
wheeler at kde.org
Sun Oct 24 13:35:40 BST 2004
On Sunday 24 October 2004 14:22, Stefan Teleman wrote:
> On Sunday 24 October 2004 04:37, you wrote:
> > And why do you use bzero if you want to achieve portable code?
>
> bzero is defined in the BSD Compatibility section of SVR4. Why is
> bzero not portable ? yes i know that 15 years ago it didnt handle
> overlapping memory correctly. this is no longer the case.
We use memset everywhere else. That's reason enough for me.
> > And what's the deal with this code?
> > - d->dirListThread->wait( 200 );
> > + d->dirListThread->wait(); // 200ms wait does not
> > work on Solaris
> >
> > Why not fix that problem on Solaris instead of making everyone
> > suffer?
>
> This is actually not related to Solaris at all. Is there any
> guarantee somewhere that the dirListThread thread will finish its
> job in 200 ms or less ? What if it takes 202 ms to finish, and
> addMatches( d->dirListThread->matches() ); is called while the other
> thread is still filling in the list ? This is not thread safe.
Sure it is. That's there because the items aren't added to the list after the
first character is pressed if the thread hasn't completed yet -- not because
things will break if it isn't.
If it takes 202 ms then you'll get your completions after the second character
rather than the first. That's all. But if it takes 3 minutes to complete
(which was actually the case that I wrote this code for -- think stale NFS
handles or an NIS system with 20,000 users) it won't block the entire UI
waiting for such.
-Scott
More information about the kde-core-devel
mailing list