You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently Tizen platform spawns a new thread every time an async Tizen API call is about to be made. This is required to make sure that Tizen API internally will attach IO sources to correct context - context which is processed by Matter event loop. A dedicated Matter event loop is required, because it is possible, that Tizen application will not run default GLib main event loop.
This PR is a first step for adding proper matter stack locking when processing GLib-based Tizen events.
Changes
run Matter GLib main event loop in a dedicated thread started during Matter stack initialization
synchronically invoke all async Tizen API calls on the Matter GLib context (so it will be processed by our dedicated thread)
removed MainLoop class
Testing
Tested locally by performing BLE commissioning Linux-Tizen, Tizen-Linux and Tizen-Tizen.
CI will test network commissioning.
It looks good overall. and i have a question for you.
In the changed structure, is there an action for timeout if the call is not completed for the asynchronous function call?
In the changed structure, is there an action for timeout if the call is not completed for the asynchronous function call?
@hyunuktak , no, currently there is no such concept as timeout for GLibMatterContextInvokeSync() calls. This function is not async, but synchronous by design. The purpose of this function is to run given callback on GLib context, that's all. The next step for this refactoring (in another PR) will be proper locking of matter stack when running callback function. However, we are not sure whether it will be possible without duplicating glib internal functions. So, other possibility is that the dedicated glib thread will be removed. So, for internal calls the g_main_context_invoke_full() in the GLibMatterContextInvokeSync() will not switch threads at all - callback will be called right away. If one wants async processing it will have to be done separately, e.g. use glib timeout source (but not with g_idle_add() - this will use global main context, and we do not want that).
EDIT:
As for now I will convert this PR to draft, because some small fixes are required for that PR (I've discovered some issues when working on #25960)
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.
Problem
Currently Tizen platform spawns a new thread every time an async Tizen API call is about to be made. This is required to make sure that Tizen API internally will attach IO sources to correct context - context which is processed by Matter event loop. A dedicated Matter event loop is required, because it is possible, that Tizen application will not run default GLib main event loop.
This PR is a first step for adding proper matter stack locking when processing GLib-based Tizen events.
Changes
Testing
Tested locally by performing BLE commissioning Linux-Tizen, Tizen-Linux and Tizen-Tizen.
CI will test network commissioning.