[Mono-devel-list] Monitor_exit from same thread required?
Joshua Perry
Jperry at 1800contacts.com
Thu Feb 26 19:43:07 EST 2004
Hello everyone,
I am having a problem with some code that works fine in windows/.NET but
not on Linux/Mono.
My data classes inherit from a base data class which has a protected
property SqlConn. The get accessor on SqlConn checks to see if the
private sqlconn field is open, if not it opens it and returns a
reference to the private field.
At the end of any method that uses the SqlConn property the developer is
supposed to call SqlConn.Close() so that connection pooling can be
effective.
When the SqlConn.Close() code is executed I get an exception in
libmono.so.0 from mono_monitor_exit+0x3b "Not locked by this thread"
In mono/mono/metadata/monitor.c I can see where this is happening...
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?
Thank you for your time
Joshua Perry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040226/f06f9ac6/attachment.html
More information about the Mono-devel-list
mailing list