Author: martin
Date: 2007-12-06 09:13:22 -0500 (Thu, 06 Dec 2007)
New Revision: 90807

Modified:
   trunk/debugger/frontend/Command.cs
   trunk/debugger/frontend/Interpreter.cs
Log:
Small fix.

Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2007-12-06 14:09:47 UTC (rev 90806)
+++ trunk/debugger/frontend/Command.cs  2007-12-06 14:13:22 UTC (rev 90807)
@@ -1282,13 +1282,18 @@
                        if (in_background)
                                return result;
 
-                       Thread ret = context.Interpreter.WaitAll 
(result.Thread, result, wait);
-                       if (ret == null)
-                               return null;
+                       if 
(context.Interpreter.DebuggerConfiguration.BrokenThreading) {
+                               Thread ret = context.Interpreter.WaitAll 
(result.Thread, result, wait);
+                               if (ret == null)
+                                       return null;
 
-                       if (ret.IsAlive)
-                               context.Interpreter.CurrentThread = ret;
-                       return ret;
+                               if (ret.IsAlive)
+                                       context.Interpreter.CurrentThread = ret;
+                               return ret;
+                       }
+
+                       context.Interpreter.WaitOne (result.Thread);
+                       return result.Thread;
                }
 
                protected abstract ThreadCommandResult DoStep (Thread thread, 
ScriptingContext context);

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2007-12-06 14:09:47 UTC (rev 
90806)
+++ trunk/debugger/frontend/Interpreter.cs      2007-12-06 14:13:22 UTC (rev 
90807)
@@ -421,6 +421,26 @@
                        return true;
                }
 
+               public bool WaitOne (Thread thread)
+               {
+                       ClearInterrupt ();
+
+                       WaitHandle[] handles = new WaitHandle [2];
+                       handles [0] = interrupt_event;
+                       handles [1] = thread.WaitHandle;
+
+                       int ret = WaitHandle.WaitAny (handles);
+
+                       if (ret == 0) {
+                               thread.Stop ();
+                               thread.WaitHandle.WaitOne ();
+                               return false;
+                       }
+
+                       CheckLastEvent (thread);
+                       return true;
+               }
+
                public Thread WaitAll (Thread thread, CommandResult result, 
bool wait)
                {
                        if (result == null)

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

Reply via email to