Author: martin
Date: 2007-01-23 16:25:05 -0500 (Tue, 23 Jan 2007)
New Revision: 71559

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/frontend/Interpreter.cs
Log:
2007-01-23  Martin Baulig  <[EMAIL PROTECTED]>

        * frontend/Interpreter.cs
        (Interpreter.WaitAll): Store the threads in a Hashtable instead of
        an ArrayList and only start each thread once.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-01-23 21:24:00 UTC (rev 71558)
+++ trunk/debugger/ChangeLog    2007-01-23 21:25:05 UTC (rev 71559)
@@ -1,5 +1,11 @@
 2007-01-23  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * frontend/Interpreter.cs
+       (Interpreter.WaitAll): Store the threads in a Hashtable instead of
+       an ArrayList and only start each thread once.
+
+2007-01-23  Martin Baulig  <[EMAIL PROTECTED]>
+
        * backend/SingleSteppingEngine.cs
        (SingleSteppingEngine.ProcessOperation): Queue the operation and
        start it later if we're currently thread-locked.

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2007-01-23 21:24:00 UTC (rev 
71558)
+++ trunk/debugger/frontend/Interpreter.cs      2007-01-23 21:25:05 UTC (rev 
71559)
@@ -469,17 +469,18 @@
                        ClearInterrupt ();
 
                        Thread stopped;
+                       Hashtable list = new Hashtable ();
+
                        do {
-                               ArrayList list = new ArrayList ();
                                foreach (Process process in Processes) {
                                        foreach (Thread t in process.GetThreads 
()) {
-                                               if (t == thread)
+                                               if ((t == thread) || 
list.Contains (t))
                                                        continue;
                                                else if (t.IsRunning)
-                                                       list.Add (t);
+                                                       list.Add (t, false);
                                                else if ((t.ThreadFlags & 
Thread.Flags.AutoRun) != 0) {
                                                        t.Continue ();
-                                                       list.Add (t);
+                                                       list.Add (t, true);
                                                }
                                        }
                                }
@@ -487,8 +488,12 @@
                                WaitHandle[] handles = new WaitHandle 
[list.Count + 2];
                                handles [0] = interrupt_event;
                                handles [1] = result.CompletedEvent;
+
+                               Thread[] threads = new Thread [list.Count];
+                               list.Keys.CopyTo (threads, 0);
+
                                for (int i = 0; i < list.Count; i++)
-                                       handles [i + 2] = ((Thread) list 
[i]).WaitHandle;
+                                       handles [i + 2] = threads 
[i].WaitHandle;
 
                                int ret = WaitHandle.WaitAny (handles);
 
@@ -505,7 +510,7 @@
                                if (ret == 1)
                                        stopped = thread;
                                else
-                                       stopped = (Thread) list [ret - 2];
+                                       stopped = threads [ret - 2];
 
                                CheckLastEvent (stopped);
                        } while (wait && (stopped != null) && (stopped != 
thread));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to