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();