TeamMentor.CoreLib.REPL.executeSnippet_SeparateThread C# (CSharp) Method

executeSnippet_SeparateThread() private method

private executeSnippet_SeparateThread ( string snippet ) : string
snippet string
return string
        public static string executeSnippet_SeparateThread(string snippet)
        {
            UserRole.Admin.demand();
            var executionResult = "";
            var sync = new AutoResetEvent(false);
            var thread = O2Thread.mtaThread(
                ()=>{
                        executionResult = executeSnippet(snippet);
                        sync.Set();
                });

            if (thread.Join(MAX_EXECUTION_TIME).isFalse())
            {
                "[REPL] Execution timeout reached".error();
                return "Error: Snippet execution timed out";
            }
            return executionResult;
        }