- Thread starter
- #151
@Developers: This brings up a C# question: is using Thread here OK or should I try to use ThreadPool? e.g. ThreadPool.QueueUserWorkItem(unused => Whatever());
Code in question:
Code in question:
Code:
var workerThreads = new List<Thread>();
// setup threads
foreach (string strFile in strFiles)
{
string file = strFile;
var thread = new Thread(() =>
{
Log.Info("PulginManager: Start loading plugin '{0}'", file);
LoadPlugin(file);
Log.Info("PulginManager: Finished loading plugin '{0}'", file);
});
workerThreads.Add(thread);
}
// start all threads
foreach (Thread thread in workerThreads)
{
thread.Start();
}
// wait for all threads to finish
foreach (Thread thread in workerThreads)
{
thread.Join();
}
Last edited: