[Monodevelop-patches-list] r2733 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Services/ProcessService
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Wed Aug 10 10:09:25 EDT 2005
Author: lluis
Date: 2005-08-10 10:09:25 -0400 (Wed, 10 Aug 2005)
New Revision: 2733
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessHostController.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
Log:
2005-08-10 Lluis Sanchez Gual <lluis at novell.com>
* Services/ProcessService/ProcessHostController.cs: Avoid unneeded
reference to GLib. Added id parameter that is added as argument
to the process. This helps identifying the process in the
process list.
* Services/ProcessService/ProcessService.cs: Provide a meaningful
id to the ProcessHostController instances.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-08-10 13:27:32 UTC (rev 2732)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-08-10 14:09:25 UTC (rev 2733)
@@ -1,3 +1,12 @@
+2005-08-10 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/ProcessService/ProcessHostController.cs: Avoid unneeded
+ reference to GLib. Added id parameter that is added as argument
+ to the process. This helps identifying the process in the
+ process list.
+ * Services/ProcessService/ProcessService.cs: Provide a meaningful
+ id to the ProcessHostController instances.
+
2005-08-10 Peter Johanson <latexer at gentoo.org>
* Services/ILoggingService.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessHostController.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessHostController.cs 2005-08-10 13:27:32 UTC (rev 2732)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessHostController.cs 2005-08-10 14:09:25 UTC (rev 2733)
@@ -34,6 +34,7 @@
using System.Runtime.Remoting.Channels;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
+using Timer = System.Timers.Timer;
namespace MonoDevelop.Services
{
@@ -45,15 +46,21 @@
bool starting;
bool stopping;
Process process;
+ Timer timer;
+ string id;
IProcessHost processHost;
ManualResetEvent runningEvent = new ManualResetEvent (false);
ManualResetEvent exitRequestEvent = new ManualResetEvent (false);
ManualResetEvent exitedEvent = new ManualResetEvent (false);
- public ProcessHostController (uint stopDelay)
+ public ProcessHostController (string id, uint stopDelay)
{
+ this.id = id;
this.stopDelay = stopDelay;
+ timer = new Timer ();
+ timer.AutoReset = false;
+ timer.Elapsed += new System.Timers.ElapsedEventHandler (WaitTimeout);
}
public void Start ()
@@ -77,7 +84,7 @@
try {
process = new Process ();
process.Exited += new EventHandler (ProcessExited);
- process.StartInfo = new ProcessStartInfo ("sh", "-c \"mono mdhost.exe\"");
+ process.StartInfo = new ProcessStartInfo ("sh", "-c \"mono mdhost.exe " + id + "\"");
process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
@@ -159,13 +166,18 @@
lastReleaseTime = DateTime.Now;
if (!stopping) {
stopping = true;
- GLib.Timeout.Add (stopDelay, new GLib.TimeoutHandler (WaitTimeout));
+ if (stopDelay == 0)
+ WaitTimeout (null, null);
+ else {
+ timer.Interval = stopDelay;
+ timer.Enabled = true;
+ }
}
}
}
}
- bool WaitTimeout ()
+ void WaitTimeout (object sender, System.Timers.ElapsedEventArgs args)
{
try {
Process oldProcess;
@@ -173,13 +185,14 @@
lock (this) {
if (references > 0) {
stopping = false;
- return false;
+ return;
}
uint waited = (uint) (DateTime.Now - lastReleaseTime).TotalMilliseconds;
if (waited < stopDelay) {
- GLib.Timeout.Add (stopDelay - waited, new GLib.TimeoutHandler (WaitTimeout));
- return false;
+ timer.Interval = stopDelay - waited;
+ timer.Enabled = true;
+ return;
}
runningEvent.Reset ();
@@ -200,7 +213,6 @@
} catch (Exception ex) {
Console.WriteLine (ex);
}
- return false;
}
public void RegisterHost (IProcessHost processHost)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-08-10 13:27:32 UTC (rev 2732)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-08-10 14:09:25 UTC (rev 2733)
@@ -113,14 +113,14 @@
return null;
}
- ProcessHostController GetHost (bool shared)
+ ProcessHostController GetHost (string id, bool shared)
{
if (!shared)
- return new ProcessHostController (0);
+ return new ProcessHostController (id, 0);
lock (this) {
if (externalProcess == null)
- externalProcess = new ProcessHostController (10000);
+ externalProcess = new ProcessHostController ("SharedHostProcess", 10000);
return externalProcess;
}
@@ -133,12 +133,12 @@
public RemoteProcessObject CreateExternalProcessObject (Type type, bool shared)
{
- return GetHost (shared).CreateInstance (type.Assembly.Location, type.FullName);
+ return GetHost (type.ToString(), shared).CreateInstance (type.Assembly.Location, type.FullName);
}
public RemoteProcessObject CreateExternalProcessObject (string assemblyPath, string typeName, bool shared)
{
- return GetHost (shared).CreateInstance (assemblyPath, typeName);
+ return GetHost (typeName, shared).CreateInstance (assemblyPath, typeName);
}
}
More information about the Monodevelop-patches-list
mailing list