From 7e34b7e06dd14c2478b8cd5d2987858f857f9908 Mon Sep 17 00:00:00 2001 From: Markus Pfeiffer Date: Tue, 19 Mar 2013 18:57:36 +0000 Subject: [PATCH] libthread_xu: Remove unnecessary calls to _thr_check_init() With the previous commit it becomes unnecessary to check whether libpthread has been initialised. This gets rid of some checks in hot codepaths. --- lib/libthread_xu/thread/thr_attr.c | 2 -- lib/libthread_xu/thread/thr_fork.c | 4 ---- lib/libthread_xu/thread/thr_mutex.c | 8 -------- lib/libthread_xu/thread/thr_self.c | 2 -- 4 files changed, 16 deletions(-) diff --git a/lib/libthread_xu/thread/thr_attr.c b/lib/libthread_xu/thread/thr_attr.c index a778c745b9..f5c3dc3387 100644 --- a/lib/libthread_xu/thread/thr_attr.c +++ b/lib/libthread_xu/thread/thr_attr.c @@ -274,8 +274,6 @@ _pthread_attr_init(pthread_attr_t *attr) int ret; pthread_attr_t pattr; - _thr_check_init(); - /* Allocate memory for the attribute object: */ if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL) /* Insufficient memory: */ diff --git a/lib/libthread_xu/thread/thr_fork.c b/lib/libthread_xu/thread/thr_fork.c index 0bbd477236..9079997c9b 100644 --- a/lib/libthread_xu/thread/thr_fork.c +++ b/lib/libthread_xu/thread/thr_fork.c @@ -83,8 +83,6 @@ _pthread_atfork(void (*prepare)(void), void (*parent)(void), struct pthread *curthread; struct pthread_atfork *af; - _thr_check_init(); - if ((af = malloc(sizeof(struct pthread_atfork))) == NULL) return (ENOMEM); @@ -104,8 +102,6 @@ __pthread_cxa_finalize(struct dl_phdr_info *phdr_info) struct pthread *curthread; struct pthread_atfork *af, *af1; - _thr_check_init(); - curthread = tls_get_curthread(); THR_UMTX_LOCK(curthread, &_thr_atfork_lock); TAILQ_FOREACH_MUTABLE(af, &_thr_atfork_list, qe, af1) { diff --git a/lib/libthread_xu/thread/thr_mutex.c b/lib/libthread_xu/thread/thr_mutex.c index d2ad1e51b4..3ddfacc115 100644 --- a/lib/libthread_xu/thread/thr_mutex.c +++ b/lib/libthread_xu/thread/thr_mutex.c @@ -372,8 +372,6 @@ __pthread_mutex_lock(pthread_mutex_t *m) struct pthread *curthread; int ret; - _thr_check_init(); - if (__predict_false(m == NULL)) return(EINVAL); @@ -396,8 +394,6 @@ _pthread_mutex_lock(pthread_mutex_t *m) struct pthread *curthread; int ret; - _thr_check_init(); - if (__predict_false(m == NULL)) return(EINVAL); @@ -421,8 +417,6 @@ __pthread_mutex_timedlock(pthread_mutex_t *m, struct pthread *curthread; int ret; - _thr_check_init(); - if (__predict_false(m == NULL)) return(EINVAL); @@ -446,8 +440,6 @@ _pthread_mutex_timedlock(pthread_mutex_t *m, struct pthread *curthread; int ret; - _thr_check_init(); - if (__predict_false(m == NULL)) return(EINVAL); diff --git a/lib/libthread_xu/thread/thr_self.c b/lib/libthread_xu/thread/thr_self.c index f237fe7a3d..16998d9a87 100644 --- a/lib/libthread_xu/thread/thr_self.c +++ b/lib/libthread_xu/thread/thr_self.c @@ -43,8 +43,6 @@ pthread_t _pthread_self(void) { - _thr_check_init(); - /* Return the running thread pointer: */ return (tls_get_curthread()); } -- 2.11.4.GIT