J
Joe HM
Hello -
I was wondering if there is a simple way of ensuring that some
statements are executed as an "atomic operation". Here is what I am
dealing with in a GUI ...
Dim mAppDomain As AppDomain
The following sets the mAppDomain in a function ...
mAppDomain = AppDomain.CreateDomain(lFullPathAssembly)
.... and does other stuff with it ...
The problem is when for whatever reason the GUI is closed while the
above is running and the above causes an exception that sets the
mAppDomain to Nothing.
Protected Overrides OnClosing(...)
If Not (mAppDomain Is Nothing) Then
AppDomain.Unload(mAppDomain)
mAppDomain = Nothing
End If
...
What could potentially happen is that the mAppDomain is set to Nothing
between the If Not () Then and the Unload() call.
Is there a way to make the If() and Unload() calls atomic so that
nothing else can be done with mAppDomain in between those calls?
Thanks!
Joe
I was wondering if there is a simple way of ensuring that some
statements are executed as an "atomic operation". Here is what I am
dealing with in a GUI ...
Dim mAppDomain As AppDomain
The following sets the mAppDomain in a function ...
mAppDomain = AppDomain.CreateDomain(lFullPathAssembly)
.... and does other stuff with it ...
The problem is when for whatever reason the GUI is closed while the
above is running and the above causes an exception that sets the
mAppDomain to Nothing.
Protected Overrides OnClosing(...)
If Not (mAppDomain Is Nothing) Then
AppDomain.Unload(mAppDomain)
mAppDomain = Nothing
End If
...
What could potentially happen is that the mAppDomain is set to Nothing
between the If Not () Then and the Unload() call.
Is there a way to make the If() and Unload() calls atomic so that
nothing else can be done with mAppDomain in between those calls?
Thanks!
Joe