* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Runtime.Remoting / System.Runtime.Remoting.Channels / RemotingThreadPool.cs
index a71910b861c895a504088a5f4be0de1db2689cf7..aa99a6554872244ad712418160a8fe74aa1ab473 100644 (file)
@@ -45,6 +45,10 @@ namespace System.Runtime.Remoting.Channels
                Queue workItems = new Queue ();
                AutoResetEvent threadDone = new AutoResetEvent (false);
                ArrayList runningThreads = new ArrayList ();
+                
+#if TARGET_JVM
+               volatile 
+#endif
                bool stopped = false;
                
                static object globalLock = new object ();
@@ -71,7 +75,11 @@ namespace System.Runtime.Remoting.Channels
                                        threadDone.Set ();
                                        workItems.Clear ();
                                        foreach (Thread t in runningThreads)
+#if !TARGET_JVM
                                                t.Abort ();
+#else
+                                               t.Interrupt();
+#endif
                                        runningThreads.Clear ();
                                }
                                if (this == sharedPool)
@@ -130,7 +138,12 @@ namespace System.Runtime.Remoting.Channels
                
                void PoolThread ()
                {
+#if !TARGET_JVM
                        while (true) {
+#else
+                       while (!stopped) 
+                       {
+#endif
                                ThreadStart work = null;
                                do {
                                        lock (workItems) {
@@ -155,8 +168,12 @@ namespace System.Runtime.Remoting.Channels
                                } while (work == null);
                                try {
                                        work ();
-                               } catch {
-                                       // Can't do anything with the exception
+                               }
+                               catch (Exception ex)
+                               {
+#if DEBUG
+                                       Console.WriteLine("The exception was caught during RemotingThreadPool.PoolThread - work: {0}, {1}", ex.GetType(), ex.Message);
+#endif
                                }
                        }
                }