Example #1
0
        private void StartParallelCompile()
        {
            if (!CodeChanged)
            {
                return;
            }
            string text      = CodeEditor.Text;
            var    ctxStruct = new ParallelCompilationState
            {
                CodeText = text,
                Sync     = SynchronizationContext.Current
            };

            ThreadPool.QueueUserWorkItem(s => PerformParallelCompile((ParallelCompilationState)s), ctxStruct);
        }
Example #2
0
        private void PerformParallelCompile(ParallelCompilationState s)
        {
            ParallelCompilationDoneState state = new ParallelCompilationDoneState();

            try
            {
                Code code = DiagramParserHelper.ParseCode(s.CodeText);
                state.CodeObject = code;
            }
            catch (Exception exc)
            {
                state.Error = exc;
            }

            s.Sync.Post(s_ => FinishParallelCompilation((ParallelCompilationDoneState)s_), state);
        }