Minor style cleanup of some code I had to look at.

(It turns out that this is the only place we're saying __inline in C++.)

Change-Id: I8095e67a385087817c47caab9a621f82f8e0cfc8
This commit is contained in:
Elliott Hughes 2014-05-28 20:30:40 -07:00
parent fae42a837a
commit 624996026b

View File

@ -305,9 +305,7 @@ int pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr)
* "type" value is zero, so the only bits that will be set are the ones in * "type" value is zero, so the only bits that will be set are the ones in
* the lock state field. * the lock state field.
*/ */
static __inline__ void static inline void _normal_lock(pthread_mutex_t* mutex, int shared) {
_normal_lock(pthread_mutex_t* mutex, int shared)
{
/* convenience shortcuts */ /* convenience shortcuts */
const int unlocked = shared | MUTEX_STATE_BITS_UNLOCKED; const int unlocked = shared | MUTEX_STATE_BITS_UNLOCKED;
const int locked_uncontended = shared | MUTEX_STATE_BITS_LOCKED_UNCONTENDED; const int locked_uncontended = shared | MUTEX_STATE_BITS_LOCKED_UNCONTENDED;
@ -335,8 +333,9 @@ _normal_lock(pthread_mutex_t* mutex, int shared)
* that the mutex is in state 2 when we go to sleep on it, which * that the mutex is in state 2 when we go to sleep on it, which
* guarantees a wake-up call. * guarantees a wake-up call.
*/ */
while (__bionic_swap(locked_contended, &mutex->value) != unlocked) while (__bionic_swap(locked_contended, &mutex->value) != unlocked) {
__futex_wait_ex(&mutex->value, shared, locked_contended, 0); __futex_wait_ex(&mutex->value, shared, locked_contended, NULL);
}
} }
ANDROID_MEMBAR_FULL(); ANDROID_MEMBAR_FULL();
} }
@ -345,9 +344,7 @@ _normal_lock(pthread_mutex_t* mutex, int shared)
* Release a non-recursive mutex. The caller is responsible for determining * Release a non-recursive mutex. The caller is responsible for determining
* that we are in fact the owner of this lock. * that we are in fact the owner of this lock.
*/ */
static __inline__ void static inline void _normal_unlock(pthread_mutex_t* mutex, int shared) {
_normal_unlock(pthread_mutex_t* mutex, int shared)
{
ANDROID_MEMBAR_FULL(); ANDROID_MEMBAR_FULL();
/* /*
@ -409,9 +406,7 @@ _normal_unlock(pthread_mutex_t* mutex, int shared)
* mvalue is the current mutex value (already loaded) * mvalue is the current mutex value (already loaded)
* mutex pointers to the mutex. * mutex pointers to the mutex.
*/ */
static __inline__ __attribute__((always_inline)) int static inline __always_inline int _recursive_increment(pthread_mutex_t* mutex, int mvalue, int mtype) {
_recursive_increment(pthread_mutex_t* mutex, int mvalue, int mtype)
{
if (mtype == MUTEX_TYPE_BITS_ERRORCHECK) { if (mtype == MUTEX_TYPE_BITS_ERRORCHECK) {
/* trying to re-lock a mutex we already acquired */ /* trying to re-lock a mutex we already acquired */
return EDEADLK; return EDEADLK;