important fact first: I am still using ChibiOS/RT 17.6 and I have not checked if this question still applies for 18.2.
I just want to register an event to an foreign thread (not 'currp').
In my case I have a control thread that configures several slaves, but calling 'chEvtRegister()' (or one of its siblings) will always register the specified event to the current thread ('currp' which is the control thread).
In 'chEvtRegisterMaskWithFlags()' (which is eventually called by its siblings) the member 'listener' of the specified event_source_t is set to 'currp', so I suppose that I is possible to have an additional argument to specify a custom thread object here. If that is possible according additional API functions like
Code: Select all
chEvtRegisterThread(event_source_t *esp, event_listener_t *elp, thread_t *tp, eventid_t event)
Until then I could just modify the 'listener' member (and just hope that the non-atomicity of this approach will cause no trouble).