From d5c9dc09a0e9218433e4bbc0f6ab7af156a71580 Mon Sep 17 00:00:00 2001 From: zhkag Date: Thu, 3 Aug 2023 15:34:42 +0800 Subject: [PATCH] =?UTF-8?q?[lwp]=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=A0=81=E8=AF=AF=E7=94=A8=20(#7906)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/lwp/lwp_pmutex.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/components/lwp/lwp_pmutex.c b/components/lwp/lwp_pmutex.c index c3772378e2..02662294f6 100644 --- a/components/lwp/lwp_pmutex.c +++ b/components/lwp/lwp_pmutex.c @@ -189,7 +189,7 @@ static int _pthread_mutex_init(void *umutex) if (lock_ret != RT_EOK) { rt_set_errno(EAGAIN); - return -EINTR; + return -EAGAIN; } lwp = lwp_self(); @@ -262,7 +262,7 @@ static int _pthread_mutex_lock_timeout(void *umutex, struct timespec *timeout) lock_ret = rt_mutex_take_interruptible(&_pmutex_lock, RT_WAITING_FOREVER); if (lock_ret != RT_EOK) { - rt_set_errno(EAGAIN); + rt_set_errno(EINTR); return -EINTR; } @@ -323,6 +323,11 @@ static int _pthread_mutex_lock_timeout(void *umutex, struct timespec *timeout) return -ETIMEDOUT; } } + else if (lock_ret == -RT_EINTR) + { + rt_set_errno(EINTR); + return -EINTR; + } else { rt_set_errno(EAGAIN); @@ -343,7 +348,7 @@ static int _pthread_mutex_unlock(void *umutex) if (lock_ret != RT_EOK) { rt_set_errno(EAGAIN); - return -EINTR; + return -EAGAIN; } lwp = lwp_self(); @@ -385,7 +390,7 @@ static int _pthread_mutex_unlock(void *umutex) if (lock_ret != RT_EOK) { rt_set_errno(EPERM); - return -EAGAIN; + return -EPERM; } return 0; } @@ -400,7 +405,7 @@ static int _pthread_mutex_destroy(void *umutex) if (lock_ret != RT_EOK) { rt_set_errno(EAGAIN); - return -EINTR; + return -EAGAIN; } lwp = lwp_self();