diff options
-rwxr-xr-x | cs/src/Ice/AssemblyUtil.cs | 25 | ||||
-rwxr-xr-x | cs/src/Ice/Instance.cs | 7 | ||||
-rwxr-xr-x | cs/src/Ice/OutgoingAsync.cs | 22 |
3 files changed, 24 insertions, 30 deletions
diff --git a/cs/src/Ice/AssemblyUtil.cs b/cs/src/Ice/AssemblyUtil.cs index cff6e28adcd..7f9e91bb7b0 100755 --- a/cs/src/Ice/AssemblyUtil.cs +++ b/cs/src/Ice/AssemblyUtil.cs @@ -135,23 +135,20 @@ namespace IceInternal // private static void loadAssemblies() { - if(!_assembliesLoaded) // Lazy initialization + lock(_mutex) // MONO BUG: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. { - lock(_mutex) // MONO BUG: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. + if(!_assembliesLoaded) { - if(!_assembliesLoaded) // Double-checked locking + Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach(Assembly a in assemblies) { - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - foreach(Assembly a in assemblies) - { - _loadedAssemblies[a.FullName] = a; - } - foreach(Assembly a in assemblies) - { - loadReferencedAssemblies(a); - } - _assembliesLoaded = true; + _loadedAssemblies[a.FullName] = a; + } + foreach(Assembly a in assemblies) + { + loadReferencedAssemblies(a); } + _assembliesLoaded = true; } } } @@ -170,7 +167,7 @@ namespace IceInternal } } - private static volatile bool _assembliesLoaded = false; + private static bool _assembliesLoaded = false; private static Hashtable _loadedAssemblies = new Hashtable(); // <string, Assembly> pairs. private static Hashtable _typeTable = new Hashtable(); // <type name, Type> pairs. private static Mutex _mutex = new Mutex(); diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs index f568863b0b3..e3743c99f26 100755 --- a/cs/src/Ice/Instance.cs +++ b/cs/src/Ice/Instance.cs @@ -486,15 +486,12 @@ namespace IceInternal // // Show process id if requested (but only once). // - if(!_printProcessIdDone && _properties.getPropertyAsInt("Ice.PrintProcessId") > 0) + lock(this) { - lock(this) + if(!_printProcessIdDone && _properties.getPropertyAsInt("Ice.PrintProcessId") > 0) { - if(!_printProcessIdDone) // Double-checked locking - { System.Console.WriteLine(Process.GetCurrentProcess().Id); _printProcessIdDone = true; - } } } diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index 34a78024a33..c81e748a8d8 100755 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -277,17 +277,17 @@ namespace IceInternal // // If we are using a router, then add the proxy to the router info object. // - try
- {
- RoutableReference rr = (RoutableReference)_reference;
- if(rr != null && rr.getRouterInfo() != null)
- {
- rr.getRouterInfo().addProxy(prx);
- }
-
- }
- catch(InvalidCastException)
- {
+ try + { + RoutableReference rr = (RoutableReference)_reference; + if(rr != null && rr.getRouterInfo() != null) + { + rr.getRouterInfo().addProxy(prx); + } + + } + catch(InvalidCastException) + { } _connection.prepareRequest(__os); |