the following is the detailed description about api:
* Setting bits in an event group is not a deterministic operation because there
* are an unknown number of tasks that may be waiting for the bit or bits being
* set. FreeRTOS does not allow nondeterministic operations to be performed in
* interrupts or from critical sections. Therefore xEventGroupSetBitsFromISR()
* sends a message to the timer task to have the set operation performed in the
* context of the timer task - where a scheduler lock is used in place of a
* critical section.
question 0:
what operations are nondeterministic operations?
questtion 1:
xEventGroupSetBitsFromISR(), if the setting of bits is at the interrupt context, and the executive resources about group event are at the critical section or interrupt context[just like xQueueGiveFromISR and queue operations], why it can not work?
The operations that DO NOT take a fixed amount of time ALWAYS are non-deterministic operations. An example is traversing a linked list as the time spent will depend on the length of the linked list.
When bits are set in an event group, we need to traverse the list of tasks which are waiting on the event group and unblock the ones whose condition is met by the newly set bits. Since traversing the list of waiting tasks is a non-deterministic operation, it is not done in the interrupt context and instead deferred to the timer task.
I understand what you express, very clearly.
So why can’t non-deterministic operations be performed in an interrupt context?[FreeRTOS does not allow nondeterministic operations to be performed in interrupts or from critical sections] ?
Is it just a matter of time? I think that the logical flow hasn’t changed. The scheduler schedules the tasks by these priorities, and everything seems normal.
So why can’t non-deterministic operations be performed in an interrupt context?
Because the ISR would have a variable processing time, depending on the list of waiting tasks.
For a task it is not important when processes have a variable execution time.
Btw : in FreeRTOS+TCP we make grateful use of event groups. However, they’re not accessed from any ISR, and thus there is no need for a timer task (see define configUSE_TIMERS).