Discussions and support about ChibiOS/RT, the free embedded RTOS.
4 posts • Page 1 of 1
chibi RT provides API to clear event in current task with chEvtGetAndClearEvents(eventmask_t). Now what I need is to clear event(s) of another thread. Suppose I know the thread reference, it seems I can just lock and directly manipulate thd->epending &= ~event. But is it safe? Shall I check thread priority? Shall I check whether the other thread is already in ready to run list? Is there any other protection I should add?
It would be safe if done in a critical zone, so use chSysLock/Unlock.
Wouldn't one also need to preform a reschedule before exiting the critical zone?
- Site Admin
- Posts: 11306
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 412 times
- Been thanked: 342 times
Clearing events would not wake up a thread so rescheduling is not required. It only has to be performed after that the state of the ready list has changed, usually after calling chSchReadyI().
Who is online
Users browsing this forum: No registered users and 4 guests