October 2015
Beginner to intermediate
400 pages
14h 44m
English
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.
The 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
from gopl.io.
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 ...