From edcdd126edf86b9990e15449ab69c8554da9e274 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 7 Jul 2021 03:30:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[kernel][ipc]=20=E7=A7=BB=E9=99=A4mutex=20R?= =?UTF-8?q?T=5FIPC=5FFLAG=5FFIFO=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ipc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index 959f0fb522..6a038cd2b6 100755 --- a/src/ipc.c +++ b/src/ipc.c @@ -548,6 +548,8 @@ RTM_EXPORT(rt_sem_control); */ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag) { + (void)flag; + /* parameter check */ RT_ASSERT(mutex != RT_NULL); @@ -562,8 +564,8 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag) mutex->original_priority = 0xFF; mutex->hold = 0; - /* set flag */ - mutex->parent.parent.flag = flag; + /* set flag and it can only be RT_IPC_FLAG_PRIO */ + mutex->parent.parent.flag = RT_IPC_FLAG_PRIO; return RT_EOK; } @@ -609,6 +611,7 @@ RTM_EXPORT(rt_mutex_detach); rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag) { struct rt_mutex *mutex; + (void)flag; RT_DEBUG_NOT_IN_INTERRUPT; @@ -625,8 +628,8 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag) mutex->original_priority = 0xFF; mutex->hold = 0; - /* set flag */ - mutex->parent.parent.flag = flag; + /* set flag and it can only be RT_IPC_FLAG_PRIO */ + mutex->parent.parent.flag = RT_IPC_FLAG_PRIO; return mutex; } From 6e334416e3c855ef17a2a59eba816408ac296a75 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 7 Jul 2021 10:16:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[ipc][mutex]=20=E8=A1=A5=E5=85=85=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ipc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index 6a038cd2b6..6bc9c079b9 100755 --- a/src/ipc.c +++ b/src/ipc.c @@ -564,7 +564,7 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag) mutex->original_priority = 0xFF; mutex->hold = 0; - /* set flag and it can only be RT_IPC_FLAG_PRIO */ + /* flag can only be RT_IPC_FLAG_PRIO. RT_IPC_FLAG_FIFO cannot solve the unbounded priority inversion problem */ mutex->parent.parent.flag = RT_IPC_FLAG_PRIO; return RT_EOK; @@ -628,7 +628,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag) mutex->original_priority = 0xFF; mutex->hold = 0; - /* set flag and it can only be RT_IPC_FLAG_PRIO */ + /* flag can only be RT_IPC_FLAG_PRIO. RT_IPC_FLAG_FIFO cannot solve the unbounded priority inversion problem */ mutex->parent.parent.flag = RT_IPC_FLAG_PRIO; return mutex;