Link to home
Start Free TrialLog in
Avatar of vinceTrace
vinceTrace

asked on

Pumping messages during Thread.Join(myTimeout)

Hi everybody,

I use a thread to wait until an event occurs.
I create and lauunch the thread, than wait until the threads ends or a timeout is reached.
The problem is (I think), that during Thread.Join(myTimeout) there is no messages pumping, and so no event can be catched !
How could I pump messages ?
Or should I use anything else that Thread.Join method ?

Thank you very much,
Vincent
....
Thread WaitUntilEventThread = new Thread(new ThreadStart(WaitEventService));
WaitUntilEventThread.Start();
WaitUntilEventThread.Join(myTimeout);
}
 
private void WaitEventService()
{
     while(!isMacroComplete)
     {
          Thread.Sleep(500);
     }
}
 
private void Pathway_MacroComplete(object sender, MyLib.MyEvent eventArgs)
{
      isMacroComplete = true;   
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial