mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
Clean up the nxmutex library
- Remove the redundant holder, as nxsem now manages hoder TID - Remove DEBUGASSERTIONS which are managed in nxsem - Remove the "reset" handling logic, as it is now managed in nxsem - Inline the simplest functions Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
committed by
Xiang Xiao
parent
ffb49a25fb
commit
156469f158
+487
-365
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -350,8 +350,7 @@ typedef struct pthread_mutex_s pthread_mutex_t;
|
||||
|
||||
#define PTHREAD_NXMUTEX_INITIALIZER { \
|
||||
NXSEM_INITIALIZER(NXSEM_NO_MHOLDER, \
|
||||
SEM_TYPE_MUTEX | PTHREAD_MUTEX_DEFAULT_PRIO_FLAGS), \
|
||||
NXMUTEX_NO_HOLDER}
|
||||
SEM_TYPE_MUTEX | PTHREAD_MUTEX_DEFAULT_PRIO_FLAGS)}
|
||||
#define PTHREAD_NXRMUTEX_INITIALIZER {PTHREAD_NXMUTEX_INITIALIZER, 0}
|
||||
|
||||
#if defined(CONFIG_PTHREAD_MUTEX_TYPES) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)
|
||||
|
||||
+10
-548
File diff suppressed because it is too large
Load Diff
@@ -100,8 +100,8 @@ static void collect_deadlock(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
pid_t holder;
|
||||
size_t i;
|
||||
|
||||
holder = mutex->holder;
|
||||
if (holder == NXMUTEX_NO_HOLDER)
|
||||
holder = nxmutex_get_holder(mutex);
|
||||
if (holder < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void nxsched_get_stateinfo(FAR struct tcb_s *tcb, FAR char *state,
|
||||
if (tcb->task_state == TSTATE_WAIT_SEM &&
|
||||
((FAR sem_t *)(tcb->waitobj))->flags & SEM_TYPE_MUTEX)
|
||||
{
|
||||
pid_t holder = ((FAR mutex_t *)(tcb->waitobj))->holder;
|
||||
pid_t holder = nxmutex_get_holder((FAR mutex_t *)tcb->waitobj);
|
||||
leave_critical_section(flags);
|
||||
|
||||
snprintf(state, length, "Waiting,Mutex:%d", holder);
|
||||
|
||||
Reference in New Issue
Block a user