From 494a1e922dd5c86ef54d7a83347ec8ba255e0e83 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 9 Oct 2009 02:10:53 -0700 Subject: Calling .Close() on AutoResetEvent and ManualResetEvent (those classes contain an unmanaged resource that will not automatically be disposed when they are GCed), and commenting out some ManualResetEvents that are not in use yet --- OpenSim/Framework/Communications/GenericAsyncResult.cs | 1 + OpenSim/Framework/Communications/RestClient.cs | 6 +++--- OpenSim/Framework/Parallel.cs | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs index efd2f43..8e3f62b 100644 --- a/OpenSim/Framework/Communications/GenericAsyncResult.cs +++ b/OpenSim/Framework/Communications/GenericAsyncResult.cs @@ -146,6 +146,7 @@ namespace OpenSim.Framework.Communications // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); + m_waitHandle.Close(); m_waitHandle = null; // Allow early GC } diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index d98f47d..a74169e 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -105,7 +105,7 @@ namespace OpenSim.Framework.Communications /// /// This flag will help block the main synchroneous method, in case we run in synchroneous mode /// - public static ManualResetEvent _allDone = new ManualResetEvent(false); + //public static ManualResetEvent _allDone = new ManualResetEvent(false); /// /// Default time out period @@ -282,12 +282,12 @@ namespace OpenSim.Framework.Communications else { s.Close(); - _allDone.Set(); + //_allDone.Set(); } } catch (Exception e) { - _allDone.Set(); + //_allDone.Set(); _asyncException = e; } } diff --git a/OpenSim/Framework/Parallel.cs b/OpenSim/Framework/Parallel.cs index 74537ba..6efdad0 100644 --- a/OpenSim/Framework/Parallel.cs +++ b/OpenSim/Framework/Parallel.cs @@ -89,6 +89,7 @@ namespace OpenSim.Framework } threadFinishEvent.WaitOne(); + threadFinishEvent.Close(); if (exception != null) throw new Exception(exception.Message, exception); @@ -148,6 +149,7 @@ namespace OpenSim.Framework } threadFinishEvent.WaitOne(); + threadFinishEvent.Close(); if (exception != null) throw new Exception(exception.Message, exception); @@ -199,6 +201,7 @@ namespace OpenSim.Framework } threadFinishEvent.WaitOne(); + threadFinishEvent.Close(); if (exception != null) throw new Exception(exception.Message, exception); -- cgit v1.1