public void Execute()
{
try
{
if (Job != null)
JobResult = Job();
else if (Task != null)
Task();
else if (Timeout != null)
TimeoutResult = Timeout();
}
catch (Exception ex)
{
StoredException = ex;
// FIXME: I assume this case can't happen. The only user interaction
// with the mainloop is with blocking tasks. Internally it's a big bug
// if i allow an exception to propagate to the mainloop.
if (!IsBlocking)
throw;
}
finally
{
WaitHandle.Set();
}
}
}