-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ipc: add nested-free flag support to mutex
This patch introduces a `nested-free` control flag to the mutex, allowing more flexible control over mutex hold limits. The change is necessary to handle scenarios where nested mutex acquisition is restricted, since it will introduce possibility of data corruption in a nested access to the critical area. Changes: - Added `ctrl_flags` field in `rt_mutex` structure to replace the reserved field for holding control flags. - Introduced `RT_MUTEX_CTRL_NESTED_FREE` command in `rt_mutex_control` to enable the new flag. - Refactored mutex initialization by extracting common logic into a new `_mutex_init` function, reducing code duplication. - Updated the `_rt_mutex_take` function to respect the `nested-free` flag, preventing nested acquisition when the flag is set. - Modified `rt_mutex_control` to handle the new control command and return appropriate error codes for invalid commands. Signed-off-by: Shell <[email protected]>
- Loading branch information
Showing
3 changed files
with
41 additions
and
32 deletions.
There are no files selected for viewing
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
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
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