This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Add pthread_cond_timedwaitonclock_np
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Mike Crowe <mac at mcrowe dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 22 Jul 2015 13:53:58 +0000
- Subject: Re: [RFC] Add pthread_cond_timedwaitonclock_np
- Authentication-results: sourceware.org; auth=none
- References: <1436277389-22478-1-git-send-email-mac at mcrowe dot com>
On Tue, 7 Jul 2015, Mike Crowe wrote:
> diff --git a/conform/data/pthread.h-data b/conform/data/pthread.h-data
> index c1e32c8..d52f298 100644
> --- a/conform/data/pthread.h-data
> +++ b/conform/data/pthread.h-data
> @@ -92,6 +92,9 @@ function int pthread_cond_destroy (pthread_cond_t*)
> function int pthread_cond_init (pthread_cond_t*, const pthread_condattr_t*)
> function int pthread_cond_signal (pthread_cond_t*)
> function int pthread_cond_timedwait (pthread_cond_t*, pthread_mutex_t*, const struct timespec*)
> +#if !defined POSIX && !defined UNIX98 && !defined XOPEN2K
> +function int pthread_cond_timedwaitonclock_np (pthread_cond_t*, pthread_mutex_t*, clockid_t, const struct timespec*)
> +#endif
No, this is wrong. A function not in any released version of POSIX should
not be added to the conform/ data.
> diff --git a/nptl/Versions b/nptl/Versions
> index 34e4b46..476301f 100644
> --- a/nptl/Versions
> +++ b/nptl/Versions
> @@ -267,6 +267,7 @@ libpthread {
> }
>
> GLIBC_2.22 {
> + pthread_cond_timedwaitonclock_np;
New symbol versions require all the ABI test baselines to be updated as
well, in the same patch adding the new ABI.
> diff --git a/nptl/tst-cond11-onclock.c b/nptl/tst-cond11-onclock.c
> new file mode 100644
> index 0000000..15b3730
> --- /dev/null
> +++ b/nptl/tst-cond11-onclock.c
> @@ -0,0 +1,206 @@
> +/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
No "Contributed by" lines in new files. 2015 in copyright dates.
> diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
> index 89d0882..221924b 100644
> --- a/sysdeps/nptl/pthread.h
> +++ b/sysdeps/nptl/pthread.h
> @@ -1002,6 +1002,19 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
> const struct timespec *__restrict __abstime)
> __nonnull ((1, 2, 3));
>
> +/* Wait for condition variable COND to be signaled or broadcast until
> + ABSTIME measured by the specified clock. MUTEX is assumed to be
> + locked before. CLOCK is a clock specified. ABSTIME is an absolute
> + time specification against CLOCK's epoch.
> +
> + This function is a cancellation point and therefore not marked with
> + __THROW. */
> +extern int pthread_cond_timedwaitonclock_np (pthread_cond_t *__restrict __cond,
> + pthread_mutex_t *__restrict __mutex,
> + __clockid_t __clock_id,
> + const struct timespec *__restrict __abstime)
> + __nonnull ((1, 2, 4));
New non-POSIX functions should be conditional on __USE_GNU in headers.
New APIs also need documentation in the glibc manual.
--
Joseph S. Myers
joseph@codesourcery.com