mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 11:12:11 +01:00
gthread: use inline keyword for _get_impl() functions
Give compiler a hint that these should be inlined, which doesn't seem to happen by default with -O2. Yields 5% speedup in artificial benchmarks, and 1% speedup in a real-world test case doing a lot of mutex locking and unlocking. https://bugzilla.gnome.org/show_bug.cgi?id=730807
This commit is contained in:
parent
db0e43d25a
commit
256305dea5
@ -114,7 +114,7 @@ g_mutex_impl_free (pthread_mutex_t *mutex)
|
|||||||
free (mutex);
|
free (mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_mutex_t *
|
static inline pthread_mutex_t *
|
||||||
g_mutex_get_impl (GMutex *mutex)
|
g_mutex_get_impl (GMutex *mutex)
|
||||||
{
|
{
|
||||||
pthread_mutex_t *impl = g_atomic_pointer_get (&mutex->p);
|
pthread_mutex_t *impl = g_atomic_pointer_get (&mutex->p);
|
||||||
@ -285,7 +285,7 @@ g_rec_mutex_impl_free (pthread_mutex_t *mutex)
|
|||||||
free (mutex);
|
free (mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_mutex_t *
|
static inline pthread_mutex_t *
|
||||||
g_rec_mutex_get_impl (GRecMutex *rec_mutex)
|
g_rec_mutex_get_impl (GRecMutex *rec_mutex)
|
||||||
{
|
{
|
||||||
pthread_mutex_t *impl = g_atomic_pointer_get (&rec_mutex->p);
|
pthread_mutex_t *impl = g_atomic_pointer_get (&rec_mutex->p);
|
||||||
@ -445,7 +445,7 @@ g_rw_lock_impl_free (pthread_rwlock_t *rwlock)
|
|||||||
free (rwlock);
|
free (rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_rwlock_t *
|
static inline pthread_rwlock_t *
|
||||||
g_rw_lock_get_impl (GRWLock *lock)
|
g_rw_lock_get_impl (GRWLock *lock)
|
||||||
{
|
{
|
||||||
pthread_rwlock_t *impl = g_atomic_pointer_get (&lock->p);
|
pthread_rwlock_t *impl = g_atomic_pointer_get (&lock->p);
|
||||||
@ -667,7 +667,7 @@ g_cond_impl_free (pthread_cond_t *cond)
|
|||||||
free (cond);
|
free (cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_cond_t *
|
static inline pthread_cond_t *
|
||||||
g_cond_get_impl (GCond *cond)
|
g_cond_get_impl (GCond *cond)
|
||||||
{
|
{
|
||||||
pthread_cond_t *impl = g_atomic_pointer_get (&cond->p);
|
pthread_cond_t *impl = g_atomic_pointer_get (&cond->p);
|
||||||
@ -1007,7 +1007,7 @@ g_private_impl_free (pthread_key_t *key)
|
|||||||
free (key);
|
free (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_key_t *
|
static inline pthread_key_t *
|
||||||
g_private_get_impl (GPrivate *key)
|
g_private_get_impl (GPrivate *key)
|
||||||
{
|
{
|
||||||
pthread_key_t *impl = g_atomic_pointer_get (&key->p);
|
pthread_key_t *impl = g_atomic_pointer_get (&key->p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user