Пример #1
0
        internal AnalysisQueue(OutOfProcProjectAnalyzer analyzer) {
            _workEvent = new AutoResetEvent(false);
            _cancel = new CancellationTokenSource();
            _analyzer = analyzer;

            _queue = new List<IAnalyzable>[PriorityCount];
            for (int i = 0; i < PriorityCount; i++) {
                _queue[i] = new List<IAnalyzable>();
            }

            _workThread = new Thread(Worker);
            _workThread.Name = "Python Analysis Queue";
            _workThread.Priority = ThreadPriority.BelowNormal;
            _workThread.IsBackground = true;

            // start the thread, wait for our synchronization context to be created
            using (AutoResetEvent threadStarted = new AutoResetEvent(false)) {
                _workThread.Start(threadStarted);
                threadStarted.WaitOne();
            }
        }
Пример #2
0
 public AddZipArchiveAnalysis(string zipFileName, Action<IProjectEntry> onFileAnalyzed, OutOfProcProjectAnalyzer analyzer) {
     _zipFileName = zipFileName;
     _onFileAnalyzed = onFileAnalyzed;
     _analyzer = analyzer;
 }
Пример #3
0
 public AddDirectoryAnalysis(string dir, Action<IProjectEntry> onFileAnalyzed, OutOfProcProjectAnalyzer analyzer) {
     _dir = dir;
     _onFileAnalyzed = onFileAnalyzed;
     _analyzer = analyzer;
 }
Пример #4
0
        private async Task RunWorker() {
            if (_interactive) {
                var analyzer = new OutOfProcProjectAnalyzer(
                    Console.OpenStandardOutput(),
                    Console.OpenStandardInput()
                );

                await analyzer.ProcessMessages();
            } else {
                WaitForOtherRun();

                while (true) {
                    try {
                        await StartTraceListener();
                        break;
                    } catch (IOException) {
                    }
                    await Task.Delay(20000);
                }

                LogToGlobal("START_STDLIB");

                for (int i = 0; i < _repeatCount && await Prepare(i == 0); ++i) {
                    await Scrape();
                    await Analyze();
                }
                await Epilogue();
            }
        }