pthread_mutx: remove unused critical_secton lock

Caused the 'nlocks' are remove from mutex, so
here don't need do critical_secton lock like nxmutex_lock

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2024-09-13 14:59:47 +08:00
committed by Xiang Xiao
parent f07a1868ce
commit fc50e57a26
2 changed files with 0 additions and 17 deletions
-9
View File
@@ -81,7 +81,6 @@ int pthread_mutex_timedlock(FAR pthread_mutex_t *mutex,
FAR const struct timespec *abs_timeout) FAR const struct timespec *abs_timeout)
{ {
int ret = EINVAL; int ret = EINVAL;
irqstate_t flags;
sinfo("mutex=%p\n", mutex); sinfo("mutex=%p\n", mutex);
DEBUGASSERT(mutex != NULL); DEBUGASSERT(mutex != NULL);
@@ -92,12 +91,6 @@ int pthread_mutex_timedlock(FAR pthread_mutex_t *mutex,
pid_t pid = mutex_get_holder(&mutex->mutex); pid_t pid = mutex_get_holder(&mutex->mutex);
#endif #endif
/* Make sure the semaphore is stable while we make the following
* checks. This all needs to be one atomic action.
*/
flags = enter_critical_section();
#ifdef CONFIG_PTHREAD_MUTEX_TYPES #ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* All mutex types except for NORMAL (and DEFAULT) will return /* All mutex types except for NORMAL (and DEFAULT) will return
* an error if the caller does not hold the mutex. * an error if the caller does not hold the mutex.
@@ -188,8 +181,6 @@ int pthread_mutex_timedlock(FAR pthread_mutex_t *mutex,
ret = pthread_mutex_take(mutex, abs_timeout); ret = pthread_mutex_take(mutex, abs_timeout);
} }
leave_critical_section(flags);
} }
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
-8
View File
@@ -70,7 +70,6 @@
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex) int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
{ {
int ret = EPERM; int ret = EPERM;
irqstate_t flags;
sinfo("mutex=%p\n", mutex); sinfo("mutex=%p\n", mutex);
DEBUGASSERT(mutex != NULL); DEBUGASSERT(mutex != NULL);
@@ -79,12 +78,6 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
return EINVAL; return EINVAL;
} }
/* Make sure the semaphore is stable while we make the following checks.
* This all needs to be one atomic action.
*/
flags = enter_critical_section();
/* The unlock operation is only performed if the mutex is actually locked. /* The unlock operation is only performed if the mutex is actually locked.
* EPERM *must* be returned if the mutex type is PTHREAD_MUTEX_ERRORCHECK * EPERM *must* be returned if the mutex type is PTHREAD_MUTEX_ERRORCHECK
* or PTHREAD_MUTEX_RECURSIVE, or the mutex is a robust mutex, and the * or PTHREAD_MUTEX_RECURSIVE, or the mutex is a robust mutex, and the
@@ -171,7 +164,6 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
} }
} }
leave_critical_section(flags);
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
return ret; return ret;
} }