thread array

  • Thread starter Thread starter Random
  • Start date Start date
R

Random

I have a DataReader with records that I need to process asyncronously. In
VB.NET, how do I declare a thread array so I can use it to start new
processes in my While reader.Read... End While statement?
 
Random said:
I have a DataReader with records that I need to process asyncronously. In
VB.NET, how do I declare a thread array so I can use it to start new
processes in my While reader.Read... End While statement?

Just declare it like any other array. What will this processing
actually be doing though? You may well find it's better to have a queue
of jobs, and a set of just a few threads which process the jobs.

See http://www.pobox.com/~skeet/csharp/threads/deadlocks.shtml for a
producer/consumer queue example.
 
I'm writing a Windows Service that runs on a timer to check a database for
email messages waiting to be processed. The service will pull in a limited
batch every few minutes for processing in a thread, and spawn subsequent
threads to process what is retreived.

Yes, I could use MSMQ for this, but am unfamiliar with the ins and outs of
processing those messages, unless you have a resource to direct me to... As
it is, this is my first multithreading application. The link you gave
looks like an alternate way of processing the emails by putting them in a
Queue object, but it'll take me time to understand how that class works. If
you have any advice I'd be happy to hear it.
 
Random said:
I'm writing a Windows Service that runs on a timer to check a database for
email messages waiting to be processed. The service will pull in a limited
batch every few minutes for processing in a thread, and spawn subsequent
threads to process what is retreived.

Yes, I could use MSMQ for this, but am unfamiliar with the ins and outs of
processing those messages, unless you have a resource to direct me to...

I wasn't suggesting an MSMQ. Just an in memory queue,
As it is, this is my first multithreading application. The link you gave
looks like an alternate way of processing the emails by putting them in a
Queue object, but it'll take me time to understand how that class works. If
you have any advice I'd be happy to hear it.

I'd read my threading article right from the start:
http://www.pobox.com/~skeet/csharp/threads/
 
Back
Top