コード例 #1
0
ファイル: Sandbox.cs プロジェクト: vendettamit/compilify
        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" };
        }
コード例 #2
0
ファイル: Sandbox.cs プロジェクト: nickdevore/Compilify
        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"
            });
        }