in reply to Re^10: Threads sharing global variable (disingenous)
in thread Threads sharing global variable

he interesting thing is that BrowserUk's demonstration runs with the lock obtained outside the while loop.

Except that it doesn't, thats ikegamis code -- get some sleep or something

  • Comment on Re^11: Threads sharing global variable (disingenous)

Replies are listed 'Best First'.
Re^12: Threads sharing global variable (disingenous)
by Anonymous Monk on Mar 10, 2016 at 13:58 UTC

    It does and shown here. Seeing two zeros in the output happens either way with the lock obtained inside or outside the while loop. The OP doesn't mention if such occurrence is valid. Therefore, likely not a problem.