This is a great introduction and, certainly, locking of shared variables is essential learning and understanding for anyone who is going to be using threads.
Perhaps it is worth mentioning, in this particular case, that the lock function doesn't need an explicit unlock. Rather, a locked variable becomes unlocked when the code execution exits the current scope.
|Replies are listed 'Best First'.|
Re^2: Threads: why locking is required when using shared variables
by ikegami (Patriarch) on Oct 20, 2006 at 17:17 UTC