public ExecutionResult Execute(ICodeAssembly assembly, TimeSpan timeout) { var task = Task<ExecutionResult>.Factory.StartNew(Execute, assembly); if (!task.Wait(timeout)) { return new ExecutionResult { Result = "[Execution timed out]" }; } return task.Result ?? new ExecutionResult { Result = "null" }; }
public ExecutionResult Execute(ICodeAssembly assembly, TimeSpan timeout) { var task = Task <ExecutionResult> .Factory.StartNew(Execute, assembly); if (!task.Wait(timeout)) { return(new ExecutionResult { Result = "[Execution timed out]" }); } return(task.Result ?? new ExecutionResult { Result = "null" }); }