{"comment":{"url":"https://api.github.com/repos/gabikliot/orleans/comments/15125718","html_url":"https://github.com/gabikliot/orleans/commit/1c668b80fb8f1d624487bbddf6bf1fabeebb46f1#commitcomment-15125718","id":15125718,"user":{"login":"saeedakhter","id":14876994,"avatar_url":"https://avatars.githubusercontent.com/u/14876994?v=3","gravatar_id":"","url":"https://api.github.com/users/saeedakhter","html_url":"https://github.com/saeedakhter","followers_url":"https://api.github.com/users/saeedakhter/followers","following_url":"https://api.github.com/users/saeedakhter/following{/other_user}","gists_url":"https://api.github.com/users/saeedakhter/gists{/gist_id}","starred_url":"https://api.github.com/users/saeedakhter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saeedakhter/subscriptions","organizations_url":"https://api.github.com/users/saeedakhter/orgs","repos_url":"https://api.github.com/users/saeedakhter/repos","events_url":"https://api.github.com/users/saeedakhter/events{/privacy}","received_events_url":"https://api.github.com/users/saeedakhter/received_events","type":"User","site_admin":false},"position":19,"line":511,"path":"src/TestInternalGrains/PersistenceTestGrains.cs","commit_id":"1c668b80fb8f1d624487bbddf6bf1fabeebb46f1","created_at":"2015-12-22T19:16:55Z","updated_at":"2015-12-22T19:16:55Z","body":"Is this safe?  If multiple threads are waiting on outstandingWriteStateOperation and a context switch happens at the wrong time, it seems that two threads could exit this while loop and two assignments to outstandingWriteStateOperation could happen (one stomping over the other).  If you were to use 'lock' (Monitor.Enter / Monitor.Exit) instead, it would ensure exactly one thread can access the following section of code...  Correct?"}}