NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Thread HowTo

Creating a Thread

A thread delegate is declared in the following way:

using System;
using System.Threading;

public class Foo 
{
//
  // The method that will be called when the thread is started
  //
  public void Baz()
  {
    Console.WriteLine("Foo Baz is running on another thread");
  }
};

public class Simple
{
  public static int Main(String[] args)
  {
    Console.WriteLine("Thread Simple Sample");

    Foo oFoo = new Foo();

    //
    // Create the thread object, passing in the Foo.Baz method
    // via a ThreadStart delegate
    //
    Thread oThread = new Thread(new ThreadStart(oFoo.Baz));

    //
    // Start the thread
    //
    oThread.Start();

    return 0;
  }
}