using System;
using System.Threading;
using System.Runtime.InteropServices;
namespace heater
{
///
/// Summary description for Class1.
///
class Heater
{
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
public uint dwOemId;
public uint dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
public uint dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public uint dwProcessorLevel;
public uint dwProcessorRevision;
}
[DllImport("kernel32")]
static extern void GetSystemInfo(ref SYSTEM_INFO pSI);
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
SYSTEM_INFO si = new SYSTEM_INFO();
GetSystemInfo(ref si);
int numThreads = (int)si.dwNumberOfProcessors;
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Idle;
Thread [] threads = new Thread[numThreads];
for (int i = 0; i < numThreads; i++)
{
threads[i] = new Thread(new ThreadStart(spin));
threads[i].Priority = ThreadPriority.Lowest;
threads[i].IsBackground = true;
threads[i].Start();
}
Console.WriteLine("Press ENTER to exit the heater");
Console.ReadLine();
}
static void spin()
{
float a = 4.431344F;
int b = 3;
while (true)
{
a = a * b / 4;
b += 1;
a = a % 10;
}
}
}
}