/// <summary>
        /// Dispose
        /// </summary>
        public override void Dispose()
        {
            if (_vInfo != null)
            {
                log.Fine(_vInfo.keyColumn + ": dispose");
            }
            if (_loader != null && _loader.IsAlive)
            {
                _loader.Interrupt();
            }
            _loader = null;
            //
            if (_lookup != null)
            {
                _lookup.Clear();
            }
            _lookup = null;
            if (_lookupDirect != null)
            {
                _lookupDirect.Clear();
            }
            _lookupDirect = null;
            //
            _vInfo = null;

            base.Dispose();
            //
        }   //  dispose
예제 #2
0
 public void StopAnimation()
 {
     this.mIsAnimated = false;
     t.Interrupt();
     t.Join();
     t = null;
 }
예제 #3
0
 private void AbortCreation()
 {
     if (TH != null)
     {
         TH.Interrupt();
         TH = null;
     }
 }
예제 #4
0
 public void StopT()
 {
     if ((_process != null))
     {
         _process.Interrupt();
         _process = null;
     }
 }
예제 #5
0
 private void _btInterrupt_Click(object sender, System.EventArgs e)
 {
     if (_thread.IsAlive)
     {
         wasUserInterrupted = true;
         _thread.Interrupt();
     }
     _btInterrupt.Visible = false;
     _btAbort.Visible     = true;
 }
예제 #6
0
 public static bool InterruptThread(ref System.Threading.Thread thread)
 {
     if (thread == null)
     {
         return(false);
     }
     try { thread.Interrupt(); return(false); }
     catch (System.Threading.ThreadInterruptedException) { return(true); }
     catch { throw; }
 }
예제 #7
0
 private void EhInterruptClicked(object sender, RoutedEventArgs e)
 {
     if (_thread.IsAlive)
     {
         _wasCancelledByUser = true;
         _thread.Interrupt();
     }
     _btInterrupt.Visibility = System.Windows.Visibility.Collapsed;
     _btAbort.Visibility     = System.Windows.Visibility.Visible;
 }
예제 #8
0
 public static void InterruptThread(ref System.Threading.Thread thread)
 {
     if (thread == null)
     {
         return;
     }
     try { thread.Interrupt(); }
     catch (System.Threading.ThreadInterruptedException) { return; }
     catch { throw; }
 }
예제 #9
0
 private void btnGenerador_Click(object sender, EventArgs e)
 {
     GeneradorLlamadas.GeneradorLlamadas generador = new GeneradorLlamadas.GeneradorLlamadas(this.centralita);
     generador.Show();
     System.Threading.Thread generadorLlamados = new System.Threading.Thread(generador.GenerarLlamadas);
     generadorLlamados.Start();
     if (generador.DialogResult == DialogResult.OK)
     {
         generadorLlamados.Interrupt();
     }
     this.centralita = generador.Centralita;
 }
예제 #10
0
        public void StopServer()
        {
            Console.WriteLine("[IPC Server Shutting Down]");

            IPCKillClient.SendKillRequest();

            IPCThread.Interrupt();

            if (!IPCThread.Join(200))
            {
                IPCThread.Abort();
            }

            this.isRunning = false;
        }
예제 #11
0
 private void StartWork(String[] filenames)
 {
     lock (queue)
     {
         foreach (var filename in filenames)
         {
             queue.Enqueue(filename);
         }
     }
     if (System.Threading.Monitor.TryEnter(insleepLock))
     {
         System.Threading.Monitor.Exit(insleepLock);
     }
     else
     {
         th.Interrupt();
     }
 }
            public static void TestOne()
            {
                Thread One = new Thread(() => {
                    string s = "";
                    try {
                        testChannel.Offer(s);
                    } catch (Exception e) {
                        Console.WriteLine("testChannel.Take() interuptCalled -> {0}", e.GetType());
                    }
                });

                One.Start();

                Console.WriteLine("Press any key to interrupt the Channel");
                Console.ReadLine();

                One.Interrupt();
            }
            public static void TestOne()
            {
                Thread One = new Thread(() => {
                    try {
                        testSema.Acquire();
                    }
                    catch (Exception e) {
                        Console.WriteLine("testSema.Acquire() interuptCalled -> {0}", e.GetType());
                    }
                });

                One.Start();

                Console.WriteLine("Press any key to interrupt the Semaphore");
                Console.ReadLine();

                One.Interrupt();
            }
예제 #14
0
 protected override void OnClosed(EventArgs e)
 {
     if (thMain != null)
     {
         //스레드가 돌고 있으면...
         if (bCheck)
         {
             //강제종료...
             thMain.Abort();
         }
         //스레드가 일시 정지 상태이면...
         else
         {
             //대기중인 스레드 종료...
             thMain.Interrupt();
         }
         thMain = null;
     }
     GC.Collect();
     base.OnClosed(e);
 }
예제 #15
0
            public static bool DatabaseOpen()
            {
                bool bResult = true;

                try
                {
                    System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
                    {
                        try
                        {
                            myConnection = new MySqlConnection(strConnectionString);
                            myConnection.Open();
                        }
                        catch (System.Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }));
                    t.Start();
                    bool completed = t.Join(3000); //half a sec of timeout
                    if (!completed)
                    {
                        bResult = false;
                        t.Interrupt();
                    }
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    bResult = false;
                }
                finally
                {
                }
                return(bResult);
            }
        public void ElementFireEvent(IdentifierType identType, string identifier, string tagName, string eventName)
        {
            isBrowserAccessible();

            waitForBrowser();
            IHTMLElement3 elem = (IHTMLElement3)getElement(identType, identifier, tagName);
            _eventInfo = new ElementEventInfo();

            //if (isParent && eventName.Equals("onclick") && !identifier.Contains(";"))
            //{
            //    searchedParent = true;
            //    isParent = false;
            //    //multiple casting to make sure it will perform the even on the first child found
            //    if (elem is HTMLDivElement)
            //    {
            //        IHTMLElement3 childElem = (IHTMLElement3)(((HTMLDivElement)elem).firstChild);
            //        _eventInfo.elem = childElem;
            //        _eventInfo.eventName = eventName;
            //    }
            //    else if (elem is HTMLTableCellClass)
            //    {
            //        IHTMLElement3 childElem = (IHTMLElement3)(((HTMLTableCell)elem).firstChild);
            //        _eventInfo.elem = childElem;
            //        _eventInfo.eventName = eventName;
            //    }
            //    else if (elem is HTMLAnchorElement)
            //    {
            //        IHTMLElement3 childElem = (IHTMLElement3)(((HTMLAnchorElement)elem).firstChild);
            //        _eventInfo.elem = childElem;
            //        _eventInfo.eventName = eventName;
            //    }
            //}
            //else
            //{
            //    isParent = false;
            //    _eventInfo.elem = elem;
            //    _eventInfo.eventName = eventName;
            //}

            _eventInfo.elem = elem;
            _eventInfo.eventName = eventName;
            toggleElementColor((IHTMLElement)elem);
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(fireTheEvent));
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();

            //When debugging you can increase this time so the thread doesn't stop before you step into fireTheEvent
            //t.Join(20000);
            t.Join(2000);

            if (_eventInfo.exception != null)
            {
                throw new StimulateElementException(identifier, eventName);
            }

            if (t.IsAlive)
                t.Interrupt();

            // Give the operating system time in case our stimulate element caused the window to close
            Sleep(100);
        }
 public virtual void Finish()
 {
     m_bDone = true;
     m_Thread.Interrupt();             // wake up the listening thread
 }
예제 #18
0
        private void btnListTelemetryUpdates_Click(object sender, EventArgs e)
        {
            disableListActionButtons();
            //initialize class for installed updates according to menu selection
            InstalledUpdatesBase instUpdates = null;
            if (tsmiUpdateHistory.Checked)
                instUpdates = new InstalledUpdatesHistory();
            else
                instUpdates = new InstalledUpdatesWMIC();

            toolStripProgressBarMain.Style = ProgressBarStyle.Marquee;
            toolStripProgressBarMain.Visible = true;
            tsslMain.Text = "Searching for installed telemetry updates...";

            bool enableUninstallButton = false;

            int i = 0;
            for (i = 0; i < m_dataKB.Count; ++i)
            {
                if (instUpdates.isInstalledByKBNumber(m_dataKB[i].KB))
                {
                    dgvTelemetryUpdates.Rows[i].Cells[idxInstalled].Value = "YES";
                    dgvTelemetryUpdates.Rows[i].Cells[idxInstalled].Style.BackColor = System.Drawing.Color.LightSalmon;
                    enableUninstallButton = true;
                }
                else
                {
                    dgvTelemetryUpdates.Rows[i].Cells[idxInstalled].Value = "no";
                    dgvTelemetryUpdates.Rows[i].Cells[idxInstalled].Style.BackColor = System.Drawing.Color.LightGreen;
                }
            } //for
            instUpdates = null;

            //Allow application to redraw the data grid view with current data.
            Application.DoEvents();

            //Search for hidden updates - this takes a while.
            tsslMain.Text = "Searching for blocked telemetry updates...";
            m_syncList = null;

            System.Threading.Thread worker = new System.Threading.Thread(threadedListProc);
            worker.Start();
            while (!worker.Join(400))
            {
                //Process application events.
                Application.DoEvents();
            } //while
            try
            {
                worker.Interrupt();
            }
            catch (Exception)
            {
                // Do nothing.
            }

            if (null == m_syncList)
                m_syncList = new List<UpdateInfo>();
            List<UpdateInfo> hiddenStuff = m_syncList;
            for (i = 0; i < m_dataKB.Count; ++i)
            {
                bool found = false;
                foreach (UpdateInfo update in hiddenStuff)
                {
                    if (update.KBArticleIDs.Contains(m_dataKB[i].KB.ToString()))
                    {
                        found = true;
                        break; //break out of inner loop (foreach)
                    } //if
                } //foreach
                if (found)
                {
                    dgvTelemetryUpdates.Rows[i].Cells[idxBlocked].Value = "yes";
                    dgvTelemetryUpdates.Rows[i].Cells[idxBlocked].Style.BackColor = System.Drawing.Color.LightGreen;
                }
                else
                {
                    dgvTelemetryUpdates.Rows[i].Cells[idxBlocked].Value = "NO";
                    dgvTelemetryUpdates.Rows[i].Cells[idxBlocked].Style.BackColor = System.Drawing.Color.LightSalmon;
                    enableUninstallButton = true;
                }
            } //for

            tsslMain.Text = "Status: None";
            toolStripProgressBarMain.Style = ProgressBarStyle.Blocks;
            toolStripProgressBarMain.Visible = false;

            btnUninstall.Enabled = enableUninstallButton;

            enableListActionButtons();
        }
예제 #19
0
 public void Close()
 {
     running = false;
     pullThread.Interrupt();
     renderThread.Interrupt();
 }
예제 #20
0
 public virtual void Interrupt()
 {
     threadField.Interrupt();
 }