TinyCLR OS - GPIO Event Thread

Hi Guys,

I was under the impression that externally initiated events were raised on their own thread (GPIO, CAN etc) hence the need for the dispatcher in NETMF but when I execute the following code the managed thread id in the event handler is always 0.

var controller = GpioController.GetDefault();

var button = controller.OpenPin(G120E.GpioPin.P2_10);

button.SetDriveMode(GpioPinDriveMode.InputPullUp);

button.ValueChanged += delegate {
Debug.WriteLine(Thread.CurrentThread.ManagedThreadId.ToString());
};

Does anybody know why?

This is probably the same issue as Issues with System.Threading.Timer ManagedThreadId · Issue #197 · ghi-electronics/TinyCLR-Ports · GitHub

Thanks John,

So its known bug that has been fixed in the next release (Version 1?)

Do you know what the time frame on that release is?

If it is indeed the same bug it has been fixed for the next release, yes. The roadmap talks about our release timeline.

2 Likes

Do all event handlers run on the same thread? That is, a single event handler thread. I believe MF had a single thread for events.

The event handler behavior is unchanged from NETMF at this time.