[Mono-devel-list] Monitor_exit from same thread required?
Joshua Perry
Jperry at 1800contacts.com
Thu Feb 26 20:16:50 EST 2004
So this is probably a bug in the SqlDataClient implementation? I am
opening and closing the SqlConnection with the same thread...
Josh
-----Original Message-----
From: Michi Henning [mailto:michi at zeroc.com]
Sent: Thursday, February 26, 2004 6:15 PM
To: Joshua Perry
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-devel-list] Monitor_exit from same thread required?
Joshua Perry wrote:
> If(mon->owner!=GetCurrentThreadId ()) {
>
>
mono_raise_exception(mono_get_exception_synchronization_lock
> ("Not locked by this thread"));
>
> return;
>
> }
>
>
>
> My question is: Is this necessary? And if so, why don't I have a
> problem with it in windows?
Windows is probably less thorough in its error checking. However,
it is illegal for a thread to unlock a monitor unless it currently
holds the lock on that monitor. Doing so has undefined behavior,
which is what you are seeing under Windows. (It just so happens
that "undefined behavior" in the Windows case just means "it
happens to work.")
Cheers,
Michi.
More information about the Mono-devel-list
mailing list