Bugzilla – Bug 319123
Thread.Interrupt() isn't implemented on mono
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by yoschy@gmx.de 2005-09-27 15:10:12 MST ---- A sleeping thread will not be interruted as in .net Testcode: ------------------------------------------------------------ using System; using System.Threading; namespace TestThreadInterrupt { /// <summary> /// Zusammenfassung für Class1. /// </summary> class Class1 { /// <summary> /// Der Haupteinstiegspunkt für die Anwendung. /// </summary> [STAThread] static void Main(string[] args) { // // TODO: Fügen Sie hier Code hinzu, um die Anwendung zu starten // Thread t1 = new Thread(new ThreadStart(WaitFor)); if (t1 != null) { t1.Name = "TestInterript"; t1.IsBackground = false; t1.Start(); Console.WriteLine("t1 start - ThreadName= {0}", t1.Name); } string line; do { line = Console.ReadLine(); //mainThread.Interrupt(); switch (line) { case "i": if (t1 != null) { t1.Interrupt(); } break; } } while (line != "q"); if (t1 != null) { t1.Abort(); t1.Join(100); } } public static void WaitFor() { do { try { Console.WriteLine("x"); Thread.Sleep(Timeout.Infinite); Console.WriteLine("X"); } catch(ThreadInterruptedException ex) { Console.WriteLine ("!!!!!!!!!!!!!!! thread wakeup !!!!!"); } }while(true); } } } -------------------------------------------------------- Steps to reproduce the problem: 1. Run the code 2. Enter 'i' to interrupt 3. 'q' to quit Actual Results: when pressing 'i' nothing, if running with MONO Expected Results: interrupting the sleeping thread and print something in the console How often does this happen? everytime Additional Information: ---- Additional Comments From robertj@gmx.net 2005-10-17 19:54:24 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO74525 *** This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"