diff options
Diffstat (limited to 'mcs/class/System/System.Net/GlobalProxySelection.cs')
-rw-r--r-- | mcs/class/System/System.Net/GlobalProxySelection.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mcs/class/System/System.Net/GlobalProxySelection.cs b/mcs/class/System/System.Net/GlobalProxySelection.cs index 54ab7d5627c..07fb23ff5f3 100644 --- a/mcs/class/System/System.Net/GlobalProxySelection.cs +++ b/mcs/class/System/System.Net/GlobalProxySelection.cs @@ -36,7 +36,8 @@ namespace System.Net {
public class GlobalProxySelection
{
- private static IWebProxy proxy;
+ volatile static IWebProxy proxy; + static readonly object lockobj = new object ();
// Constructors
public GlobalProxySelection() { }
@@ -48,7 +49,7 @@ namespace System.Net if (proxy != null)
return proxy;
- lock (typeof (GlobalProxySelection)) {
+ lock (lockobj) {
if (proxy != null)
return proxy;
@@ -68,9 +69,7 @@ namespace System.Net if (value == null)
throw new ArgumentNullException ("GlobalProxySelection.Select",
"null IWebProxy not allowed. Use GetEmptyWebProxy ()");
-
- lock (typeof (GlobalProxySelection))
- proxy = value;
+ proxy = value;
}
}
|