This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Add pthread_cond_timedwaitonclock_np


On Wednesday 22 July 2015 at 13:53:58 +0000, Joseph Myers wrote:
> 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.

OK.

> > 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.

OK. I'll move to GLIBC_2.23 too since 2.22 is now frozen.

> > 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.

I can fix that (although since it's basically a copy of tst-cond11.c I
think that I need to keep Ulrich Drepper's notice too.)

> > 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.

OK.

> New APIs also need documentation in the glibc manual.

I'm having some trouble with the safety section. pthread_cond_timedwait
isn't documented in the glibc manual since it is a POSIX function.

The pthread_cond_timedwait man page tells me that pthread_cond_timedwait is
MT-Safe but it's presumably neither AC-Safe nor AS-Safe. I'm not sure what to put in
the asunsafe and acunsafe reasons. Cut and paste gave me:

 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@asulock}}

is this correct?

(I also plan to submit changes to the pthread_cond_timedwait man page.)

Thanks for the review.

Mike.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]