14.2.2.5 Synchronous and Asynchronous APIs

A few API calls, which do not consume much execution time, are synchronous such as those that involve reading from and writing to internal stack structures. For example, NWK_GetShortAddr() API returns the short address maintained by network layer synchronously. But tasks implying sending requests to other nodes in the network are always executed asynchronously as they result in considerably longer waiting for response. In order not to block the execution flow (which is single-threaded on an MCU) such requests provide pointers to callbacks which are called at the end of request execution by the underlying layer, to which the request is issued. For example , BDB_InvokeCommissioningReq(mode) API can be invoked from application layer and the corresponding callback is called once the commissioning procedure is complete, between this API invocation and callback, application layer is free to execute any other task.