WikiFunctions.DBScanner.MainProcess.Stop C# (CSharp) Метод

Stop() публичный Метод

public Stop ( ) : void
Результат void
        public void Stop()
        {
            Run = false;
            if (ScanThread == null) return;

            ScanThread.Abort();
            foreach (Thread thr in SecondaryThreads)
            {
                thr.Abort();
            }
            ScanThread.Join();

            foreach (Thread thr in SecondaryThreads)
            {
                // avoid deadlocks when calling from secondary thread
                if (thr.ManagedThreadId != Thread.CurrentThread.ManagedThreadId)
                    thr.Join();
            }
        }

Usage Example

Пример #1
0
        private void AddArticle(string article)
        {
            if (string.IsNullOrEmpty(article))
            {
                return;
            }

            Article a = new Article(article);

            lbArticles.Items.Add(a);

            if (AWBListbox != null)
            {
                AWBListbox.Items.Add(a);
            }

            Matches++;

            if (Matches >= Limit)
            {
                Main.Stop();
            }
        }