[Mono-list] Thread.Interrupt()

Yury Serdyuk Yury@serdyuk.botik.ru
Fri, 28 Feb 2003 14:53:08 +0300


Hi !

We see in the "List of not-implemented classes" that
the Interrupt - method didn't realized yet.
In particular, the following program  doesn't work properly  :

using System.Threading;
using System;

public class A {

  public void ThreadOne() {
    Console.WriteLine( "Going to sleep!" );
    try {
      Thread.Sleep( int.MaxValue );
    }
    catch ( ThreadInterruptedException ) {
      Console.WriteLine( "Interrupted!" );
    }
    Console.WriteLine( "Running again!" );
  }

  public static void Main( string[] args ) {
    A a = new A();
    Thread t = new Thread( new ThreadStart( a.ThreadOne ) );
    t.Start();
    Console.WriteLine( "Press enter to interrupt!" );
    string s = Console.ReadLine();
    t.Interrupt();
    Console.WriteLine( "Main finished!" );
  }
}

But this function is very important for multithreading applications.
So,  tell us about the current status of this problem,
or is there a walk-around of it ?

P.S. We tested Thread.Interrupt()  on Mono 0.19.

Yury Serdyuk.