private static void BootCallback(TaskHandle taskId, string taskName, var returnValue, TaskExitStatus exitStatus) { if (!_booted) { string reason = "reason unknown"; if (exitStatus == TaskExitStatus.UnhandledException) { if (returnValue != null) { Exception exception = returnValue.Cast<Exception>(); reason = exception.ToString() + "\n " + exception.StackTrace; } } throw new NativeError("XaeiOS.Boot process failed to boot: " + reason); } }
private void InternalCallback(TaskHandle task, string taskName, var returnValue, TaskExitStatus exitStatus) { //Logging.Trace("Thread internal callback: " + this + ":" + this.Name); _running = false; //Logging.Trace("Unregistering thread: " + this + ":" + this.Name); ThreadManager.UnregisterThread(this); if (exitStatus == TaskExitStatus.UnhandledException) { _unhandledException = returnValue.Cast<Object>() as Exception; } else if (exitStatus == TaskExitStatus.CriticalError) { _unhandledException = new ExecutionEngineException(returnValue.NativeToString()); } if (Callback != null) { // TODO: Use the SIP thread pool to run this callback Callback(); } else { if (_unhandledException != null) { Console.WriteLine("An unhandled exception occurred in thread: " + this + ": " + _unhandledException + "\n" + _unhandledException.StackTrace); } } }