nptl: Reinstate pthread_timedjoin_np as a cancellation point (BZ#24215)

Message ID aa00cf9e-a45c-15a9-66da-4c951fb6b161@linaro.org
State Dropped
Headers

Commit Message

Adhemerval Zanella Netto Feb. 14, 2019, 5:02 p.m. UTC
  On 13/02/2019 12:09, Carlos O'Donell wrote:
> On 2/12/19 3:18 PM, Adhemerval Zanella wrote:
>> Patch ce7eb0e90315 ("nptl: Cleanup cancellation macros") changed the
>> join sequence for internal common __pthread_timedjoin_ex to use the
>> new macro lll_wait_tid.  The idea was this macro would issue the
>> cancellable futex operation depending whether the timeout is used or
>> not.  However if a timeout is used, __lll_timedwait_tid is called and
>> it is not a cancellable entrypoint.
> 
> Thanks for following up on this.
> 
> OK for master with additional comment below (see Fix:).
> 
> Once you commit I'll clean up the straggling comments that I fixed
> before (pthread_tryjoin.c still has a wrong comment).

Thanks for the review, I added the change locally:
  

Comments

Andreas Schwab Feb. 14, 2019, 5:18 p.m. UTC | #1
On Feb 14 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c
> index 3f9cf1674b..f719613268 100644
> --- a/nptl/pthread_join_common.c
> +++ b/nptl/pthread_join_common.c
> @@ -120,6 +120,10 @@ __pthread_timedjoin_ex (pthread_t threadid, void **thread_return,
>      /* There is already somebody waiting for the thread.  */
>      return EINVAL;
>  
> +  /* BLOCK waits either indefinitely or based on an absolute time.  POSIX also
> +     states a cancellation points shall occur for pthread_join, and we use the

s/points/point/

Andreas.
  

Patch

diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c
index 3f9cf1674b..f719613268 100644
--- a/nptl/pthread_join_common.c
+++ b/nptl/pthread_join_common.c
@@ -120,6 +120,10 @@  __pthread_timedjoin_ex (pthread_t threadid, void **thread_return,
     /* There is already somebody waiting for the thread.  */
     return EINVAL;
 
+  /* BLOCK waits either indefinitely or based on an absolute time.  POSIX also
+     states a cancellation points shall occur for pthread_join, and we use the
+     same rationale for posix_timedjoin_np.  Both timedwait_tid and the futex
+     call use the cancellable variant.  */
   if (block)
     {
       /* During the wait we change to asynchronous cancellation.  If we