c# - How do I "Thread.Join" a BackgroundWorker? -


Say I'm displaying a form to the user, and using backgroundwalker to do some work behind some background scenes I am doing

By the time the user clicks ok, I can not work until the BackgroundWorker is completed. If this is not okay when the user clicks ok, then I want to show the waiter till it continues till then. And then release.

What is the best way to implement it?

I know I could use a simple old thread, and then thread it. Join, but I like the backgrounder

Can it be done well? is?

You can use this code instead BW

  Var reset event = new manual rsset (incorrect); ThreadPool.QueueUserWorkItem (state => {Thread.Sleep (5000); // LongRunning function, async call resetEvent.Set ();});  
Reset event when user clicks Waiting (); // Blocked calls,

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -