Click to See Complete Forum and Search --> : Is it possible to signal AutoResetEvent from one thread to another?


Silver Ghost
December 19th, 2002, 02:05 AM
subj?

MartinL
December 19th, 2002, 05:15 AM
public class SomeClass
{
protected AutoResetEvent evt;

protected void Thread1Fnc()
{
evt.WaitOne();
MessageBox.Show("Thread1: The event has been signaled");
}

protected void Thread2Fnc()
{
MessageBox.Show("Thread2: Press OK to signal the event");
evt.Set();
}

// ...
public void Test()
{
evt = new AutoResetEvent(false);
Thread th1 = new Thread(ThreadStart(Thread1Fnc));
Thread th2 = new Thread(ThreadStart(Thread2Fnc));
th1.Start();
th2.Start();
}
}


Martin

Silver Ghost
December 19th, 2002, 03:15 PM
wow thankx

pareshgh
December 19th, 2002, 05:12 PM
my method is same as martin the only diff is i keep all objects n 1 class so that i can access that ref. in thread.

Paresh