471,328 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,328 software developers and data experts.

VS2005: Problem with System.Threading.Monitor

Hi,

I just tried to convert my current project to the new beta 2 of the .net
framework and I encountered some problems with my thread synchronization -
that formerly worked well.

When I release a monitor by System.Threading.Monitor(myvar) I receive the
following error message:

System.Threading.SynchronizationLockException: Object synchronization method
was called from an unsynchronized block of code.

Of course I acquired the Monitor some lines above by
System.Threading.Monitor.Enter(myvar).

can anyone help?

Thanks
Peter
Jul 21 '05 #1
1 2056
Peter Schmitz <Pe**********@discussions.microsoft.com> wrote:
I just tried to convert my current project to the new beta 2 of the .net
framework and I encountered some problems with my thread synchronization -
that formerly worked well.

When I release a monitor by System.Threading.Monitor(myvar) I receive the
following error message:

System.Threading.SynchronizationLockException: Object synchronization method
was called from an unsynchronized block of code.

Of course I acquired the Monitor some lines above by
System.Threading.Monitor.Enter(myvar).

can anyone help?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

You could well have a bug in your code which is masked by another bug
in the framework - Monitor.Exit doesn't check whether or not the
monitor is currently owned in v1.1.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by ste | last post: by
22 posts views Thread by Jeff Louie | last post: by
1 post views Thread by solex | last post: by
1 post views Thread by Peter Schmitz | last post: by
5 posts views Thread by Mr | last post: by
2 posts views Thread by Rene Ruppert | last post: by
reply views Thread by fiefie.niles | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.