Commit 498f100
committed
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]>1 parent cc1707e commit 498f100
3 files changed
+31
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
448 | 453 | | |
449 | 454 | | |
450 | 455 | | |
451 | | - | |
| 456 | + | |
452 | 457 | | |
453 | 458 | | |
454 | | - | |
| 459 | + | |
455 | 460 | | |
456 | 461 | | |
457 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
983 | 1000 | | |
984 | 1001 | | |
985 | 1002 | | |
| |||
1004 | 1021 | | |
1005 | 1022 | | |
1006 | 1023 | | |
1007 | | - | |
| 1024 | + | |
1008 | 1025 | | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | 1026 | | |
1013 | 1027 | | |
1014 | 1028 | | |
1015 | 1029 | | |
1016 | 1030 | | |
1017 | 1031 | | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
| 1032 | + | |
1030 | 1033 | | |
1031 | 1034 | | |
1032 | 1035 | | |
| |||
1230 | 1233 | | |
1231 | 1234 | | |
1232 | 1235 | | |
1233 | | - | |
| 1236 | + | |
1234 | 1237 | | |
1235 | 1238 | | |
1236 | 1239 | | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
1243 | 1243 | | |
1244 | 1244 | | |
1245 | 1245 | | |
1246 | 1246 | | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
| 1247 | + | |
1259 | 1248 | | |
1260 | 1249 | | |
1261 | 1250 | | |
| |||
1351 | 1340 | | |
1352 | 1341 | | |
1353 | 1342 | | |
1354 | | - | |
| 1343 | + | |
| 1344 | + | |
1355 | 1345 | | |
1356 | 1346 | | |
1357 | 1347 | | |
| |||
0 commit comments