Ok. ikegami made a correct statement about cond_wait in which the lock is re-obtained before cond_wait returns. This is documented in the threads::shared documentation. Ikegami did not lie.
I ran your demonstration with the lock outside the while loop. The $cnt variable in the printer routine is for having the script exit at some point.
In reply to Re^15: Threads sharing global variable (disingenous)
by Anonymous Monk
in thread Threads sharing global variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |