From 4735850f7a4f07f05ee9ff405238332f4bb3ab50 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 25 Jan 2017 17:08:51 -0200 Subject: nptl: Consolidate pthread_{timed,try}join{_np} This patch consolidates the pthread_join and gnu extensions to avoid code duplication. The function pthread_join, pthread_tryjoin_np, and pthread_timedjoin_np are now based on pthread_timedjoin_ex. It also fixes some inconsistencies on ESRCH, EINVAL, EDEADLK handling (where each implementation differs from each other) and also on clenup handler (which now always use a CAS). Checked on i686-linux-gnu and x86_64-linux-gnu. * nptl/pthreadP.h (__pthread_timedjoin_np): Define. * nptl/pthread_join.c (pthread_join): Use __pthread_timedjoin_np. * nptl/pthread_tryjoin.c (pthread_tryjoin): Likewise. * nptl/pthread_timedjoin.c (cleanup): Use CAS on argument setting. (pthread_timedjoin_np): Define internal symbol and common code from pthread_join. * sysdeps/unix/sysv/linux/i386/lowlevellock.h (__lll_timedwait_tid): Remove superflous checks. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__lll_timedwait_tid): Likewise. Signed-off-by: Adhemerval Zanella Reviewed-by: Carlos O'Donell --- nptl/pthreadP.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nptl/pthreadP.h') diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 713000e32d..2646b8f605 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -506,6 +506,8 @@ extern int __pthread_setcanceltype (int type, int *oldtype); extern int __pthread_enable_asynccancel (void) attribute_hidden; extern void __pthread_disable_asynccancel (int oldtype) attribute_hidden; extern void __pthread_testcancel (void); +extern int __pthread_timedjoin_ex (pthread_t, void **, const struct timespec *, + bool); #if IS_IN (libpthread) hidden_proto (__pthread_mutex_init) @@ -524,6 +526,7 @@ hidden_proto (__pthread_setcancelstate) hidden_proto (__pthread_testcancel) hidden_proto (__pthread_mutexattr_init) hidden_proto (__pthread_mutexattr_settype) +hidden_proto (__pthread_timedjoin_ex) #endif extern int __pthread_cond_broadcast_2_0 (pthread_cond_2_0_t *cond); -- cgit 1.4.1