Re: adapter.fill and progress bar

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



No time for sample,
- events raised from backgroundworker (which is not the only way to use
worker threads) are synchronized with the control backgroundworker is placed
on. Thus you don't need any special synchronization.
- perhaps it has some overhead - but the advantage is big: having a
responsive UI. The same could be said for windows - why does windows use
multithreading?
- even with using raw threads, the synchronization with UI is fairly simple

You might read Chris Sell's article on this topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms01232003.asp

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx> wrote in message
news:uBCwsfcFGHA.1124@xxxxxxxxxxxxxxxxxxxxxxx
> Miha,
>
>> Way better is to use a worker thread for stunts like this - otherwise
>> window refreshing sucks...
>>
> Do you mean instead of?
>
> Can you show me an example, I am curious about that. I could never do it
> in another way than this because of the fact that opposite to the Update
> the Fill does not give any event during the fill.
>
> An extra problem is that the backgroundworker is not in the UI and the
> progressbar has to be showed.
>
> However let us make it simple, I am really curious for your sample. (Can
> be in C# no problem)
>
> By the way, I will never use this because of all the other overhead. But
> that I told in my message.
>
> Cor
>


.



Relevant Pages

  • Re: ThreadPool Questions
    ... You sould have an output data pool. ... Worker threads all continuously take data out of the queue, ... is good but you want less synchronization between threads. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Load secondary form in backgroundworker thread
    ... Is it possible to load this form in a backgroundworker and then ... initialization is done, create the form on the main thread. ... A window is owned by the thread on which it was created. ... A very simple synchronization method would be to use the Control.Invoke ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Informing UI thread of target for sending messages?
    ... But now it seems worker threads would be better. ... And UI threads are still not a good choice; an I/O Completion Port ... cost of thread creation would be unnoticeable. ... the MFC synchronization primitves are crap and should be avoided. ...
    (microsoft.public.vc.mfc)
  • Re: Sequential consitency on X86_64 - implementation of a bust wait algo not working inspite of
    ... here is a very simple distributed spin-wait barrier synchronization algorithm I have whipped up: ... void wait ... waits for all worker threads to hit the barrier ...
    (comp.arch)
  • Re: Informing UI thread of target for sending messages?
    ... Completion Port ... But now it seems worker threads would be better. ... The code is already fast enough for a single file, ... the MFC synchronization primitves are crap and should be avoided. ...
    (microsoft.public.vc.mfc)