MF Threads

If you have no done so already, harvest some of the power sitting in VS waiting to be used.
VS added some really good thread debugging support. Ever wonder what thread is calling that button interrupt code? Catch it in action with the Debug Threads windows.

  1. Set a break point in your callback.
  2. Run your code till it hit break point (i.e. push that button or timer).
  3. While your code is halted, open a Debug/Windows/Threads window.

As seen below, I have two active threads. The first is the Main thread that is blocked on Thread.Sleep(-1). The second (Id:3) is the callback thread the system created to call my port interrupt event code.

In .Net that second thread would be either a thread pool thread or a completion port thread. In NETMF, I don’t think either of those exists, but NETMF does a good job making that happen anyway via some abstration. I think maybe it uses some APM passing style. In any case, show that to your Arduino buddies.

Thanks for the tip. Is this window also available in VS2008?

I think there was some support. Can’t remember.