Why is there a lock around the for loop? The threads are joined and not running anymore, no other thread could possibly intefere. Suggets removing them alltogether.
- You're correct that the loop lock isn't necessary. One argument for leaving it there is that the code maintains the invariant that all accesses of the (potentially) shared data happen behind a lock, which might be considered good style. If the extra lock makes the example confusing, however, it might be worth discarding it. Nate 17:29, 25 September 2012 (PDT)
- I fixed that. --188.8.131.52 16:08, 12 January 2013 (PST)