HEng
1
What order / when are the events dispatched by the system?
I am concerned that they are interrupt-driven, in which case I need to make sure that certain bits of code are re-entrant.
Are they dispatched by interrupt?
Are they dispatched during Particle.process()?
Are they dispatched after loop() terminates?
Something else?
Bonus question: is this affected by SYSTEM_THREAD(ENABLED)?
HEng
2
I guess I found my answer, although it still isn’t clear when I can expect my code to yield to the event handlers.
void system_notify_event(system_event_t event, uint32_t data, void* pointer, void (*fn)(void* data), void* fndata)
{
APPLICATION_THREAD_CONTEXT_ASYNC(system_notify_event(event, data, pointer, fn, fndata));
// run event notifications on the application thread
System event handlers are called between calls to your loop() function, so you generally don’t need to worry about synchronization.
Rick
2 Likes