title: Windows Services and the Main thread
body: <p>I'm writing a Windows Service in .NET 3.5.
  The typical programming model for a windows service is to override the <code>OnStart</code> method to assemble your classes before initiating any long-running processes on another thread.</p>
  
  <p>This is because the <code>OnStart</code> event must return after a default of 30 seconds before a timeout.</p>
  
  <p>In my scenario this thread is vitally important and so I want to create some form of heartbeat system to monitor its state and recycle / recreate it if necessary.</p>
  
  <p>Ideally I would perform this heartbeat check from the main application thread (because the heartbeat must never die) but I do not see how I can marshal any new calls onto that thread.</p>
  
  <p>How would you solve this problem?
  Perhaps my intended approach is wrong? If so, how else would you approach it?</p>