I want to start a quite expensive process (jackd) from a Mono application, and do not need full access to the process from the application itself. As the process is so expensive in terms of CPU usage, a Glib.IdleHandler for polling the process will not work, as it is never executed, and the GUI becomes unresponsive. Is there any way to have the cake and eating it at the same time in Mono?
EDIT:
I only need to be able to start and stop the process from Mono, I do not need information about the state of the process or if it has exited, as my application will register itself as a client to jackd, basically I need a "replacement" for bash's jackd &>/dev/null 2>&1 & for the System.Diagnostics.Process ;).
Here is what I have so far for starting and stopping the process:
public void StartJackd()
{
_jackd = new Process ();
_jackd.StartInfo = _jackdStartup;
if (_jackd.Start ())
{
_jackd.EnableRaisingEvents = true;
_jackd.Exited += JackdExited;
}
}
public void StopJackd()
{
if (_jackd != null && !_jackd.HasExited)
{
_jackd.CloseMainWindow ();
}
}
And somewhere else I have this code for registering the IdleHandler:
GLib.Idle.Add(new GLib.IdleHandler(UpdateJackdConnections));
This handler will fire all the time, while the process is not running, but never, when jackd is running.