I need help with a simple multithreaded design.
I have an app that loops through each pixel of an image and calculates the data at that point. Each pixel is completely independent of the others, so there shouldn't be any synchronization issues.
Mainly, I need to find out how to spawn about 5 threads that each handle a 32x32 square, and do this for the entire image. Or possibly 5 threads each doing a pixel in the 32x32 square, I don't know which is better.
I already have a subclass of a Qthread and a method that can handle the square, I just don't know how to create the next thread when one finishes. I thought about a loop, but it waits for all 5 threads to finish before creating the next set.
I hope this all makes sense.
Note: this is done in C++ on Linux
I have an app that loops through each pixel of an image and calculates the data at that point. Each pixel is completely independent of the others, so there shouldn't be any synchronization issues.
Mainly, I need to find out how to spawn about 5 threads that each handle a 32x32 square, and do this for the entire image. Or possibly 5 threads each doing a pixel in the 32x32 square, I don't know which is better.
I already have a subclass of a Qthread and a method that can handle the square, I just don't know how to create the next thread when one finishes. I thought about a loop, but it waits for all 5 threads to finish before creating the next set.
I hope this all makes sense.
Note: this is done in C++ on Linux