MonoDevelop.Projects.Formats.MSBuild.MainClass.WatchProcess C# (CSharp) Method

WatchProcess() public static method

public static WatchProcess ( string procId ) : void
procId string
return void
		public static void WatchProcess (string procId)
		{
			int id = int.Parse (procId);
			var t = new Thread (delegate () {
				while (true) {
					Thread.Sleep (1000);
					try {
						// Throws exception if process is not running.
						// When watching a .NET process from Mono, GetProcessById may
						// return the process with HasExited=true
						Process p = Process.GetProcessById (id);
						if (p.HasExited)
							break;
					}
					catch {
						break;
					}
				}
				exitEvent.Set ();
			});
			t.IsBackground = true;
			t.Start ();
		}
	}