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

prioritization
John Hurliman 2009-10-09 02:10:53 -07:00
parent a5b9971fd7
commit 494a1e922d
5 changed files with 10 additions and 5 deletions

View File

@ -146,6 +146,7 @@ namespace OpenSim.Framework.Communications
// If the operation isn't done, wait for it // If the operation isn't done, wait for it
AsyncWaitHandle.WaitOne(); AsyncWaitHandle.WaitOne();
AsyncWaitHandle.Close(); AsyncWaitHandle.Close();
m_waitHandle.Close();
m_waitHandle = null; // Allow early GC m_waitHandle = null; // Allow early GC
} }

View File

@ -105,7 +105,7 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// This flag will help block the main synchroneous method, in case we run in synchroneous mode /// This flag will help block the main synchroneous method, in case we run in synchroneous mode
/// </summary> /// </summary>
public static ManualResetEvent _allDone = new ManualResetEvent(false); //public static ManualResetEvent _allDone = new ManualResetEvent(false);
/// <summary> /// <summary>
/// Default time out period /// Default time out period
@ -282,12 +282,12 @@ namespace OpenSim.Framework.Communications
else else
{ {
s.Close(); s.Close();
_allDone.Set(); //_allDone.Set();
} }
} }
catch (Exception e) catch (Exception e)
{ {
_allDone.Set(); //_allDone.Set();
_asyncException = e; _asyncException = e;
} }
} }

View File

@ -89,6 +89,7 @@ namespace OpenSim.Framework
} }
threadFinishEvent.WaitOne(); threadFinishEvent.WaitOne();
threadFinishEvent.Close();
if (exception != null) if (exception != null)
throw new Exception(exception.Message, exception); throw new Exception(exception.Message, exception);
@ -148,6 +149,7 @@ namespace OpenSim.Framework
} }
threadFinishEvent.WaitOne(); threadFinishEvent.WaitOne();
threadFinishEvent.Close();
if (exception != null) if (exception != null)
throw new Exception(exception.Message, exception); throw new Exception(exception.Message, exception);
@ -199,6 +201,7 @@ namespace OpenSim.Framework
} }
threadFinishEvent.WaitOne(); threadFinishEvent.WaitOne();
threadFinishEvent.Close();
if (exception != null) if (exception != null)
throw new Exception(exception.Message, exception); throw new Exception(exception.Message, exception);

View File

@ -58,6 +58,7 @@ namespace OpenSim
m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : "");
WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.WaitOne();
WorldHasComeToAnEnd.Close();
} }
/// <summary> /// <summary>

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public string body; public string body;
public int responseCode; public int responseCode;
public string responseBody; public string responseBody;
public ManualResetEvent ev; //public ManualResetEvent ev;
public bool requestDone; public bool requestDone;
public int startTime; public int startTime;
public string uri; public string uri;
@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
requestData.headers["x-query-string"] = queryString; requestData.headers["x-query-string"] = queryString;
requestData.headers["x-script-url"] = url.url; requestData.headers["x-script-url"] = url.url;
requestData.ev = new ManualResetEvent(false); //requestData.ev = new ManualResetEvent(false);
lock (url.requests) lock (url.requests)
{ {
url.requests.Add(requestID, requestData); url.requests.Add(requestID, requestData);