Why not while(true)?

Kerry over at the MS Gadgeteer site recently posted this great explanation of the event dispatcher, execution model, and best practices for using them. If you’re new to Gadgeteer hardware and/or coming from smaller FEZ boards or Arduinos, this article will hopefully help prevent some headaches.

[url]http://blogs.msdn.com/b/net_gadgeteer/archive/2011/12/19/why-not-while-true.aspx[/url]

Yep, this is a good one.

@ Gus This would be great info to add to your new Gadgeteer eBook.

Curious why Gadgeteer uses ProgramStarted() vs. Main(). Just wondering why one wouldn’t just use main().

@ rocketbob

Just a thought…I have no idea if this is the real reason, but perhaps it’s because if they just used Main() folks would expect it to behave like any other NETMF project, when clearly it does not…

Look at the ProgramStarted as an event that tells you that all background work is done and main loop is running do any custom post start initialization thread creation etc. Main function usually ends the program on exit. When ProgramStarts exits the application is still running.

I understand why, but I don’t understand why this is hardware specific (Gadgeteer) and not applied to the framework.