private static bool cancelLoop = false;
private static int counter = 0;

private static void LoopThreadStart() {
	while (!cancelLoop) {
		++counter;
	}
}
		
static unsafe void Main(string[] args) {
	Thread loopThread = new Thread(LoopThreadStart);
	loopThread.Start();
	Thread.Sleep(1000);
	cancelLoop = true;

	loopThread.Join();
	Console.WriteLine(counter);

	Console.ReadKey();
}