More work on debugging prog5, I have a new idea for how to deal with
joining threads at the end that I wrote in a comment.