|
-
December 19th, 2002, 03:05 AM
#1
Is it possible to signal AutoResetEvent from one thread to another?
-
December 19th, 2002, 06:15 AM
#2
Code:
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
-
December 19th, 2002, 04:15 PM
#3
-
December 19th, 2002, 06:12 PM
#4
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|