I read that event handlers execute in a “hidden” thread inside NETMF. If a data structure is shared between a user thread and and event handler is locking needed?



Some say: it depends.

Is it a special case in NETMF?

@ RoSchmi - To quote Gilbert and Sullivan…

[quote]What, never?
No, never!
What, never?
Well, hardly ever…[/quote]

In general, if any thread modifies a shared resource, then locking should be used by all threads. A readonly resource does not need to be locked.

If one has a good understanding of their application and knows about thread usage and locking, then there might be situations where locking is not required. But, if someone asks if locking is required, with shared threads, I always say yes.

Lol, that’s good.