Re: Threading in .Net...
- From: Mehdi <vioccc@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 6 Jun 2006 20:28:09 +0100
On 6 Jun 2006 12:12:57 -0700, CirclesTraveled wrote:
It is very easy to create threads and start them in .Net.
However, the way it provides messaging between threads is a little
confusing to me or I might be just over analysing it. I could use
monitor like the critical section variables to protect the global
memory structure, but how I do I notify Child Thread 2 that there is a
message waiting in the Queue.
What is the recomended way to do this in .Net?
Use a ManualResetEvent. Have thread 2 wait on it. In thread 1, when a new
item is placed on the queue, set the event. This will Cause thread 2 to
wake up. Then thread 2 can do it's job and process all the items in the
queue. When it's done it can reset the ManualResetEvent and wait until
woken up again.
.
- References:
- Threading in .Net...
- From: CirclesTraveled
- Threading in .Net...
- Prev by Date: Threading in .Net...
- Next by Date: Re: not sure how to describe this question...
- Previous by thread: Threading in .Net...
- Next by thread: Re: Threading in .Net...
- Index(es):
Relevant Pages
|