The counter doesn't seem to be incremented atomically. This leads to output like this immediately after every thread has been woken up:
b769fb30 : woke up 3 threads
b2e94b70 : incremented counter to 6
b4e98b70 : incremented counter to 6
b4e98b70 : incremented counter to 7
b769db70 : incremented counter to 6