I have objects, they get locks. I want to test if they are locked without acquiring a lock. The idea is if I TryEnter()
then i have to Exit()
if true
to only check the lock correctly.
Seems like a really basic question, how is it done?
What possible information can you get from knowing the lock was unlocked back when you looked at it? By the time you make a decision based on that information, the lock may be already taken.