There is an option to run the EmberZnet stack in the combination with Micrium Os. This gives the advantage of an operating system, but this gives also the complexity of it. To help you to reduce the complexity we give you the following advice to avoid the problem of shared resources. We advise to use Custom Events to move API calls to the Zigbee Stack Task, this can be seen in the figure below.
This example will periodically send a ZDO message. The different tasks are handled below in more detail.
This is the kernel of the Micrium operating system, this will handle the scheduling of the task and many more things.
This task is periodically triggered and will send a ZDO message. The custom event will be set in this task.
This task is handling the complete Zigbee stack, this is resulting in handling the radio and the complete EmberZnet stack. As part of the EmberZnet, it will handle also the custom event and will call the custom event handler when the event is set. In the handler, the ZDO message will be sent. Because the handler is called from the same context as the EmberZnet stack there is no change on shared resource problems.