in reply to threads::shared: lock a VARIABLE
threads::shared locks are advisory (see the docs). You have to test for it in your TryToReadLockVar thread rather than just altering it regardless of the lock.