ot-rtos icon indicating copy to clipboard operation
ot-rtos copied to clipboard

Potential duplicate otrTaskNotifyGive() call

Open theHurc opened this issue 5 years ago • 1 comments

https://github.com/openthread/ot-rtos/blob/a6e1c6ad2e46652c5942deba46ea2706c6b9524b/include/openthread/openthread-freertos.h#L132

I'm not sure this otrTaskNotifyGive() line is necessary. If a user makes an OpenThread call using the OT_API_CALL(...) macro from another FreeRTOS task and a call to otTaskletsProcess() is required, won't the callback otSysEventSignalPending() be called which also calls otrTaskNotifyGive()? It seems this would duplicate the call to otrTaskNotifyGive(). Not that big of a deal because each call to otrTaskNotifyGive() will just run the application loop an extra time, but if you're running a low-power application you wouldn't really want that.

So as an example: Calling OT_API_CALL(otSetStateChangedCallback) wouldn't actually require a call to otTaskletsProcess() but the macro OT_API_CALL(...) would force a call to that application layer function anyway.

Thanks

theHurc avatar Oct 06 '20 22:10 theHurc

To further this idea: The callbacks for both otSysEventSignalPending and otTaskletsSignalPending both call otrTaskNotifyGive. So notifying the task in the macro OT_API_CALL(...) is going to be redundant I believe.

theHurc avatar Oct 06 '20 22:10 theHurc