[PATCH v2 2/4] manual: Add documentation for pthread_tryjoin_np and pthread_timedjoin_np

Yann Droneaud ydroneaud@opteya.com
Fri Sep 27 09:08:00 GMT 2019


Hi,

Le jeudi 26 septembre 2019 à 14:26 -0700, Adhemerval Zanella a écrit :
> 
> On 18/09/2019 05:30, Mike Crowe wrote:
> > This documentation isn't perfect, but it's better than nothing and can
> > hopefully act as a basis for future improvement. In particular, although
> > I'm certain that the functions are MT-Safe, I'm not sure about the rest of
> > the @safety line.
> > 
> > Yann Droneaud pointed out that pthread_timedjoin_np would wait forever if
> > the timeout parameter is passed as NULL. Since it's now too late to change
> > that, I've documented it.
> 
> To which semantic do you think it would be better to change? Since this
> symbol are not yet in POSIX there still the possibility to change it
> by using a new plus a compat symbol.
> 

I think it's the behavior we want in order to accomodate for every
needs with a single interface:

- wait forever (aka. pthread_join())        : pass NULL
- wait:        (aka. pthread_timedjoin_np()): pass deadline
- don't wait   (aka. pthread_tryjoin_np())  : pass current time

The later could be made more usuable if (struct timespec){ 0, 0 } would
have a special meaning, but it cannot, as timestamp can overflow ...

Regards.

-- 
Yann Droneaud
OPTEYA




More information about the Libc-alpha mailing list