[06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS

Message ID 20200114185255.25813-8-samuel.thibault@ens-lyon.org
State New
Headers show
Series
  • Port C11 threads to GNU/Hurd
Related show

Commit Message

Samuel Thibault Jan. 14, 2020, 6:52 p.m.
It is optional in POSIX.
---
 nptl/tss_create.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.24.1

Comments

Adhemerval Zanella Jan. 20, 2020, 6:40 p.m. | #1
On 14/01/2020 15:52, Samuel Thibault wrote:
> It is optional in POSIX.


LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>


> ---

>  nptl/tss_create.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/nptl/tss_create.c b/nptl/tss_create.c

> index ea1f2e0fba..4e170dd4fc 100644

> --- a/nptl/tss_create.c

> +++ b/nptl/tss_create.c

> @@ -23,8 +23,10 @@ tss_create (tss_t *tss_id, tss_dtor_t destructor)

>  {

>    _Static_assert (sizeof (tss_t) == sizeof (pthread_key_t),

>  		  "sizeof (tss_t) != sizeof (pthread_key_t)");

> +#ifdef PTHREAD_DESTRUCTOR_ITERATIONS

>    _Static_assert (TSS_DTOR_ITERATIONS == PTHREAD_DESTRUCTOR_ITERATIONS,

>  		  "TSS_DTOR_ITERATIONS != PTHREAD_DESTRUCTOR_ITERATIONS");

> +#endif

>  

>    int err_code = __pthread_key_create (tss_id, destructor);

>    return thrd_err_map (err_code);

>

Patch

diff --git a/nptl/tss_create.c b/nptl/tss_create.c
index ea1f2e0fba..4e170dd4fc 100644
--- a/nptl/tss_create.c
+++ b/nptl/tss_create.c
@@ -23,8 +23,10 @@  tss_create (tss_t *tss_id, tss_dtor_t destructor)
 {
   _Static_assert (sizeof (tss_t) == sizeof (pthread_key_t),
 		  "sizeof (tss_t) != sizeof (pthread_key_t)");
+#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
   _Static_assert (TSS_DTOR_ITERATIONS == PTHREAD_DESTRUCTOR_ITERATIONS,
 		  "TSS_DTOR_ITERATIONS != PTHREAD_DESTRUCTOR_ITERATIONS");
+#endif
 
   int err_code = __pthread_key_create (tss_id, destructor);
   return thrd_err_map (err_code);