Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
4.33/5 (2 votes)
See more:
Below is my code

public class Program
{
public static void Main(string[] args)
{
string[] filePaths = Directory.GetFiles(@"c:\\images\\");
for (int i = 0; i<filepaths.length;>
{
Thread thread1 = new Thread(() => getImageData(filePaths[i], i));
thread1.Start();
}
}
public static void getImageData(string filename, int x)
{
//Process image
}

}

I want to process two images simultaneously to minimize processing time. Above code only starts all the thread but can not give output.If I use thread1.Join() it completes one thread first and starts another. I want to run multiple threads simultaneously. Please give me solution for this.
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900