[PATCH v2 3/4] nptl: Add pthread_clockjoin_np

Mike Crowe mac@mcrowe.com
Sat Sep 28 19:45:00 GMT 2019


On Thursday 26 September 2019 at 16:17:53 -0700, Adhemerval Zanella wrote:
> > diff --git a/nptl/tst-join3.c b/nptl/tst-join3.c
> > index a4ae459..c06e65a 100644
> > --- a/nptl/tst-join3.c
> > +++ b/nptl/tst-join3.c
> > @@ -28,6 +28,8 @@
> >  #include <support/xtime.h>
> >  
> >  
> > +#define CLOCK_USE_TIMEDJOIN (-1)
> > +
> >  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
> >  
> >  
> > @@ -35,19 +37,23 @@ static void *
> >  tf (void *arg)
> >  {
> >    xpthread_mutex_lock (&lock);
> > +  xpthread_mutex_unlock (&lock);
> >  
> 
> Maybe it would be better to move the unlock after the loop test, 
> to mimic how the other unlock does?

Do you mean that I should unlock the mutex after the loop inside
do_test_clock? If so, that would mean unlocking it on a different thread
and that doesn't sound like it's guaranteed to be safe.

Or perhaps you meant something different?

(The use of a mutex for this test works, but it's non-obvious. Perhaps a
semaphore would be clearer?)

Thanks for the rest of the review. I will make the changes you describe.

Mike.



More information about the Libc-alpha mailing list