Jump to content
  • Advertisement
Sign in to follow this  

[.net] Monitor Warning

This topic is 4789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just FYI in 2.0 Monitor.Exit() calls are checked to ensure that the thread calling Exit owns the lock to begin with. I had a sinister little bug where I was locking a string variable and setting it to String.Empty in one part of my code. I was throwing exceptions in 2.0 but not 1.1 and it was becase String.Empty is of course a separate, static object. So in some cases I actually didn't own the lock on my String variable, even though just looking at the code made it seem like I did. Fixed the problem by using a separate empty Object for locking.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!