[glib] gthread: use inline keyword for _get_impl() functions



commit 256305dea5ce0a7c4512b4842b0703c025853e1c
Author: Tim-Philipp Müller <tim centricular com>
Date:   Sat May 31 14:54:08 2014 +0100

    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

 glib/gthread-posix.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index 2f54070..6f5a606 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -114,7 +114,7 @@ g_mutex_impl_free (pthread_mutex_t *mutex)
   free (mutex);
 }
 
-static pthread_mutex_t *
+static inline pthread_mutex_t *
 g_mutex_get_impl (GMutex *mutex)
 {
   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);
 }
 
-static pthread_mutex_t *
+static inline pthread_mutex_t *
 g_rec_mutex_get_impl (GRecMutex *rec_mutex)
 {
   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);
 }
 
-static pthread_rwlock_t *
+static inline pthread_rwlock_t *
 g_rw_lock_get_impl (GRWLock *lock)
 {
   pthread_rwlock_t *impl = g_atomic_pointer_get (&lock->p);
@@ -667,7 +667,7 @@ g_cond_impl_free (pthread_cond_t *cond)
   free (cond);
 }
 
-static pthread_cond_t *
+static inline pthread_cond_t *
 g_cond_get_impl (GCond *cond)
 {
   pthread_cond_t *impl = g_atomic_pointer_get (&cond->p);
@@ -1007,7 +1007,7 @@ g_private_impl_free (pthread_key_t *key)
   free (key);
 }
 
-static pthread_key_t *
+static inline pthread_key_t *
 g_private_get_impl (GPrivate *key)
 {
   pthread_key_t *impl = g_atomic_pointer_get (&key->p);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]