I'm setting up a windows service, and it's going to use the smartthreadpool
from the code project (basically an advanced windows threadpool). It's the
first time i'm using it and i'm trying to make sure i don't make any type of
design mistakes right off the bat.
1) Is it okay to do something like this:
foreach (DistDataSet.distlistRow lr in this.DistData.distlist)
{
workItemResults.Add(m_SmartThreadPool.QueueWorkIte m(new
WorkItemCallback(this.Distribute),lr));
}
In other words, send the distribute function a row from the datareader. Will
this cause a problem when the work items are working on different rows of the
datareader?
2)Also, there are different points in thread pools where i reference global
arraylists. With arraylists, is it necessary to lock them if i'm adding or
removing from them? Also, when i'm reading a value from them? Would that be
necessary to lock also?
Thanks for any help.
|