Rename CONFIG_MUTEX_TYPES to CONFIG_PTHREAD_MUTEX_TYPES

This commit is contained in:
Gregory Nutt
2017-03-27 09:08:14 -06:00
parent 9484ac5c22
commit b07d3fc305
330 changed files with 351 additions and 351 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ void pthread_mutex_inconsistent(FAR struct pthread_tcb_s *tcb);
# define pthread_mutex_give(m) pthread_givesemaphore(&(m)->sem)
#endif
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
int pthread_mutexattr_verifytype(int type);
#endif
+1 -1
View File
@@ -120,7 +120,7 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex)
mutex->pid = -1;
mutex->flags &= _PTHREAD_MFLAGS_ROBUST;
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
mutex->nlocks = 0;
#endif
/* Reset the semaphore. This has the same affect as if the
+3 -3
View File
@@ -72,7 +72,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
FAR const pthread_mutexattr_t *attr)
{
int pshared = 0;
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
uint8_t type = PTHREAD_MUTEX_DEFAULT;
#endif
#ifdef CONFIG_PRIORITY_INHERITANCE
@@ -104,7 +104,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
#ifdef CONFIG_PRIORITY_INHERITANCE
proto = attr->proto;
#endif
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
type = attr->type;
#endif
#ifdef CONFIG_PTHREAD_MUTEX_BOTH
@@ -141,7 +141,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
mutex->flags = (robust == PTHREAD_MUTEX_ROBUST ? _PTHREAD_MFLAGS_ROBUST : 0);
#endif
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* Set up attributes unique to the mutex type */
mutex->type = type;
+6 -6
View File
@@ -120,7 +120,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
sched_lock();
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* All mutex types except for NORMAL (and DEFAULT) will return
* and an error error if the caller does not hold the mutex.
*/
@@ -162,7 +162,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
}
}
else
#endif /* CONFIG_MUTEX_TYPES */
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
/* The calling thread does not hold the semaphore. The correct
@@ -172,7 +172,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
*/
#ifdef CONFIG_PTHREAD_MUTEX_BOTH
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* Include check if this is a NORMAL mutex and that it is robust */
if (mutex->pid > 0 &&
@@ -180,14 +180,14 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
mutex->type != PTHREAD_MUTEX_NORMAL) &&
sched_gettcb(mutex->pid) == NULL)
#else /* CONFIG_MUTEX_TYPES */
#else /* CONFIG_PTHREAD_MUTEX_TYPES */
/* This can only be a NORMAL mutex. Include check if it is robust */
if (mutex->pid > 0 &&
(mutex->flags & _PTHREAD_MFLAGS_ROBUST) != 0 &&
sched_gettcb(mutex->pid) == NULL)
#endif /* CONFIG_MUTEX_TYPES */
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */
#else /* CONFIG_PTHREAD_MUTEX_ROBUST */
/* This mutex is always robust, whatever type it is. */
@@ -224,7 +224,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
if (ret == OK)
{
mutex->pid = mypid;
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
mutex->nlocks = 1;
#endif
}
+5 -5
View File
@@ -111,7 +111,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
mutex->pid = mypid;
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
if (mutex->type == PTHREAD_MUTEX_RECURSIVE)
{
mutex->nlocks = 1;
@@ -129,7 +129,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
int errcode = get_errno();
if (errcode == EAGAIN)
{
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* Check if recursive mutex was locked by the calling thread. */
if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->pid == mypid)
@@ -157,7 +157,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
*/
#ifdef CONFIG_PTHREAD_MUTEX_BOTH
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* Check if this NORMAL mutex is robust */
if (mutex->pid > 0 &&
@@ -165,14 +165,14 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
mutex->type != PTHREAD_MUTEX_NORMAL) &&
sched_gettcb(mutex->pid) == NULL)
#else /* CONFIG_MUTEX_TYPES */
#else /* CONFIG_PTHREAD_MUTEX_TYPES */
/* Check if this NORMAL mutex is robust */
if (mutex->pid > 0 &&
(mutex->flags & _PTHREAD_MFLAGS_ROBUST) != 0 &&
sched_gettcb(mutex->pid) == NULL)
#endif /* CONFIG_MUTEX_TYPES */
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */
#else /* CONFIG_PTHREAD_MUTEX_ROBUST */
/* This mutex is always robust, whatever type it is. */
+7 -7
View File
@@ -92,7 +92,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
sched_lock();
if (mutex != NULL)
{
#if !defined(CONFIG_PTHREAD_MUTEX_UNSAFE) || defined(CONFIG_MUTEX_TYPES)
#if !defined(CONFIG_PTHREAD_MUTEX_UNSAFE) || defined(CONFIG_PTHREAD_MUTEX_TYPES)
/* Does the calling thread own the semaphore? If no, should we return
* an error?
*
@@ -112,7 +112,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
if (mutex->pid != (int)getpid())
#elif defined(CONFIG_PTHREAD_MUTEX_UNSAFE) && defined(CONFIG_MUTEX_TYPES)
#elif defined(CONFIG_PTHREAD_MUTEX_UNSAFE) && defined(CONFIG_PTHREAD_MUTEX_TYPES)
/* If mutex types are not supported, then all mutexes are NORMAL (or
* DEFAULT). Error checking should never be performed for the
* non-robust NORMAL mutex type.
@@ -124,7 +124,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
/* Skip the error check if this is a non-robust NORMAL mutex */
bool errcheck = ((mutex->flags & _PTHREAD_MFLAGS_ROBUST) != 0);
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
errcheck |= (mutex->type != PTHREAD_MUTEX_NORMAL);
#endif
@@ -150,9 +150,9 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
ret = EPERM;
}
else
#endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE || CONFIG_MUTEX_TYPES */
#endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE || CONFIG_PTHREAD_MUTEX_TYPES */
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
/* Yes, the caller owns the semaphore.. Is this a recursive mutex? */
if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->nlocks > 1)
@@ -167,7 +167,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
}
else
#endif /* CONFIG_MUTEX_TYPES */
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */
/* This is either a non-recursive mutex or is the outermost unlock of
* a recursive mutex.
@@ -182,7 +182,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
/* Nullify the pid and lock count then post the semaphore */
mutex->pid = -1;
#ifdef CONFIG_MUTEX_TYPES
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
mutex->nlocks = 0;
#endif
ret = pthread_mutex_give(mutex);