Eventloop in main thread to master #6186
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This has the same content as ARMmbed/mbed-os-confidential-m#7 and #5752, just the target repo and branch are different.
Copypasta from commit:
--8<--8<--8<--8<--8<
The separate eventloop thread may not be necessary on all uses, as one
can use the existing main thread for event dispatching. Add a
conditional nanostack-hal.event-loop-dispatch-from-application, which
disables the thread creation.
Note: the ns_hal_init must be ran from the same thread which will be
used to execute the event loop later.
--8<--8<--8<--8<--8<
By removing the separate event loop thread, one saves about 6KB of RAM in mbed cloud client example side.
Status
READY
Migrations
Unless one sets the "nanostack-hal.event-loop-dispatch-from-application" to true, the existing behavior is not changed.
NO
Related PRs
Todos
Deploy notes
Steps to test or reproduce
Testing can be done by adding following code to the end of main(), where one has already initialized the event loop and the application code: