We have a legacy VB .NET class that relies on quite a few gloabal
variables and states. It handles calls from different threads well as
long as two calls doesn't come at the same time so a viable solution
would be to enclose all the public methods in a construct like this
Monitor.Enter(me.globaLock)
try
<func tionbody>
finally
Monitor.exit(me.globalLock)
end try
This is not an ugly, errorprone solution that causes a lot of work so
instead I would like to know if it is possible to automatically force
the object to allow only one thread to use it at any given moment and
force other calling threads to wait (as would happen with a monmitor in
each public method)?
Many thanks
Tim