Note that this code takes about 30-40 seconds to run to completion.
Your output should match this output in the following sense:
all entries in red should appear in the
same order here as in your output. All entries in
gray should appear, but if they
appear in a different order in your output, that's ok. (This means
that the gray entries' order depends on scheduling policies and
timing coincedences that you don't control.)
bash$ ./threadpool_test
**main** dispatch 3
**main** dispatch 6
in dispatch 3
**main** dispatch 7
in dispatch 6
done dispatch 3
**main** done first
in dispatch 7
done dispatch 6
done dispatch 7
**main** dispatch 3
**main** dispatch 6
**main** dispatch 7
in dispatch 6
in dispatch 3
done dispatch 3
**main done second
in dispatch 7
done dispatch 6
done dispatch 7
bash$