Not sure if this is the appropriate place to ask, but I'm fiddling with some multi-threaded code and confused about some behavior. Gist:
https://gist.github.com/anonymous/7341ab84ad07a5fe0a9af48d0bb3b963. When I run that sometimes I see 101 print statements, sometimes only 100. I assumed that because the increment of
counter
and the setting of
continueWorking
happened under lock this code would stop at 100 runs. Am I just being dense with my multi-threading logic, or do I not understand how these locks work or something?