Advertisement

03.23.2006 at 02:00AM PST, ID: 21785513
[x]
Attachment Details

to make multithread as singlethread

Asked by Kelmen in C# Programming Language

Tags: singlethread, multithread

Greeting,

  Me dunno really how to workout the subject. Basically I already have a threading stuff.
  What it do is in Windows Form, when I click a button, a process start (which call a web service, so can imagine the waiting needed). I use threading here as the process take long, so not freeze the form and cursor. When the process done, it will invoke my callback delegate to display the results. Working as expected, no problem.

private void StartJob()
{
  ThreadedProcess objTP = new ThreadedProcess();
  objTP.StartTranslator(parameter...., new Callback_Doing(Doing), new Callback_Done(Done));
  objTP = null;
}

public void Doing(...) {...}

public void Done(...) {...}

But now I in another routine, which is generating the results onto a file, so:
  Do
  {
  StartJob();
  result grabbed from Done().... *** AAA
  Write result into File...
  } until all-done;

How do I worked out the -AAA- part?
I reuse the StartJob(), which spin off a thread, but I have to wait for the result grabbed in Done().
Should I lookinto ThreadPool, AutoResetEvent ?
I can't find more details/samples from the MSDN, any good ref would be good for me too.

TQStart Free Trial
 
Loading Advertisement...
 
[+][-]03.23.2006 at 02:23AM PST, ID: 16267610

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.23.2006 at 06:33PM PST, ID: 16276865

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.19.2006 at 07:09PM PDT, ID: 16494478

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Tags: singlethread, multithread
Sign Up Now!
Solution Provided By: nehaya
Participating Experts: 2
Solution Grade: B
 
 
[+][-]04.19.2006 at 09:52PM PDT, ID: 16495086

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32