Bug 319123 (MONO76251) - Thread.Interrupt() isn't implemented on mono
Summary: Thread.Interrupt() isn't implemented on mono
Status: RESOLVED MOVED
Alias: MONO76251
Product: Mono: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: 1.1
Hardware: Other Linux
: P3 - Medium : Major
Target Milestone: ---
Assignee: Dick Porter
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-27 22:10 UTC by Yosch
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:32:26 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"