Queue Data to another thread

  • Thread starter Thread starter Maanu
  • Start date Start date
M

Maanu

Hi,

I have two threads thread1 and thread2. Thread1 will give queue some data so
that Thread2 will process the queued data.

What mechanisms are available in c# for doing this?

Thanks!
 
Maanu said:
Hi,

I have two threads thread1 and thread2. Thread1 will give queue some data so
that Thread2 will process the queued data.

What mechanisms are available in c# for doing this?

There is nothing built-in per se. But, a basic implementation will make
use of the System.Collections.Generic.Queue<T> class, the Monitor class,
and the "lock" statement (which implicitly uses the Monitor class).

If you use Google Groups to search this newsgroup for past discussions
on the question, you'll come up with a wealth of information, including
various code examples. See also "producer/consumer pattern" (in this
newsgroup and elsewhere).

Pete
 
Back
Top