//stops old sorting threads.
        private void clearOldSorts()
        {
            //stop all threads
            Iterator <DrawnSort> it = my_sorts.values().iterator();

            while (it.hasNext())
            {
                DrawnSort ds = it.next();
                //if the old thread is still not stopped
                if (ds.active())
                {
                    ds.stop();
                    Cursor = Cursors.WaitCursor;

                    //loop while the thread is active
                    while (ds.active())
                    {
                        Application.DoEvents();
                        Thread.Sleep(100);
                    }

                    Cursor = Cursors.Default;
                }
            }

            //clear old entries
            my_sorts.clear();
        }
Exemple #2
0
        //forces an old thread to stop and loops until it has been aborted/stopped.
        private void resetOldThread()
        {
            //if the old thread is still not stopped
            if (my_drawable.active())
            {
                my_drawable.stop();
                Cursor = Cursors.WaitCursor;

                //loop while the thread is active
                while (my_drawable.active())
                {
                    Application.DoEvents();
                    Thread.Sleep(100);
                }

                Cursor = Cursors.Default;
            }
        }