sreejith s

sreejith s

  • NA
  • 1
  • 0

I need to know how Thread.Suspend and Thread.Resume replace with other available classes in.Net .My code is writen below . Thanks in Advance

Jun 15 2009 2:49 AM
public class Alpha { // This method that will be called when the thread is started public void Beta() { while (true) { try { Console.WriteLine("Alpha.Beta is running in its own thread."); Thread.CurrentThread.Suspend(); } catch { } } } }; public class Simple { public static int Main() { Alpha oAlpha = new Alpha(); Thread oThread = new Thread(new ThreadStart(oAlpha.Beta)); oThread.Start(); try { while (true) { if(oThread.ThreadState ==ThreadState.Suspended && oThread.IsAlive) oThread.Resume(); Thread.Sleep(1000); } } catch(Exception ex) { Console.WriteLine (ex.ToString ()); } return 0; } }