In this section, we’ll explore some common concurrency patterns for
executing all the iterations of a loop in parallel.
We’ll consider the problem of producing thumbnail-size images from a
set of full-size ones.
gopl.io/ch8/thumbnail package provides an
ImageFile function that can scale a
single image. We won’t show its implementation but it can be downloaded
package thumbnail // ImageFile reads an image from infile and writes // a thumbnail-size version of it in the same directory. // It returns the generated file name, e.g., "foo.thumb.jpg". func ImageFile(infile string) (string, error)
The program below loops over a list of image file names and ...