concurrency patters code for chapter 6