Design pattern for RPC (with MPU)

twam wrote on Monday, August 27, 2018:

Hello everybody,

I’m using FreeRTOS 10 on a Cortex M4 core with MPU support.

I was wondering if there are any design patterns for calling code in a safe way in other threads in an RPC fashion, e.g. suppose we have power management running it a separate task and I want to query a current state of the power management from another task.

I can imagine many ‘manual’ ways of achieving this by creating two queues between the tasks and sending requests back and forth, but the question is if there is a more generic way which also works when there are many possible callers.

Looking forward to good ideas!
Tobias

richarddamon wrote on Tuesday, August 28, 2018:

One way to handle this is to give each task a queue that it monitors, and when you send a request, you include in the structure with the request the handle for the queue to send the answer back on, that gets around much of the problem with multiple callers.