why main thread is still working in threadpool

Answered why main thread is still working in threadpool

  • Wednesday, April 18, 2012 4:19 AM
     
     

    I wrote a code that i wan to call worker thread to get some info from wcf service , but when i debugg it, i find out that main thread is still running

     ThreadPool.QueueUserWorkItem(o =>
                    {
                        ServiceConnection sc = new ServiceConnection();
                           Deployment.Current.Dispatcher.BeginInvoke(()=>
                               {
                                  rowDetail rwdetail = new rowDetail(sc.getHistoryInformation(((Historyreport)e.AddedItems[0]).rowCode));
                                  rwdetail.Show();
                               }
                    );});
           

All Replies

  • Wednesday, April 18, 2012 8:06 AM
     
     Answered

    Deployment.Current.Dispatcher's thread *IS* the UI thread.  So basically you're starting a thread that executes something asynchronously on the main thread.