From: Bruno Haible Date: Thu, 20 Jun 2019 01:53:51 +0000 (+0200) Subject: tls tests: Small improvements. X-Git-Tag: v1.0~4867 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=97ae5364457c30ea826fa5e6c0c0a41c73a30c38;p=gnulib.git tls tests: Small improvements. * tests/test-tls.c: Include . (worker_thread): Avoid gcc warning on 64-bit mingw. (test_tls): Pass a different id to each thread. * modules/tls-tests (Depends-on): Add stdint. --- diff --git a/ChangeLog b/ChangeLog index 9472275f44..b8ff877c14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-06-20 Bruno Haible + + tls tests: Small improvements. + * tests/test-tls.c: Include . + (worker_thread): Avoid gcc warning on 64-bit mingw. + (test_tls): Pass a different id to each thread. + * modules/tls-tests (Depends-on): Add stdint. + 2019-06-20 Bruno Haible cond tests: Simplify. diff --git a/modules/tls-tests b/modules/tls-tests index 562e36b21d..b93f6735dd 100644 --- a/modules/tls-tests +++ b/modules/tls-tests @@ -3,6 +3,7 @@ tests/test-tls.c Depends-on: thread +stdint yield configure.ac: diff --git a/tests/test-tls.c b/tests/test-tls.c index 6bfa6ff4b1..0cd6b1d947 100644 --- a/tests/test-tls.c +++ b/tests/test-tls.c @@ -46,6 +46,7 @@ /* Number of operations performed in each thread. */ #define REPEAT_COUNT 50000 +#include #include #include #include @@ -90,7 +91,7 @@ static gl_tls_key_t mykeys[KEYS_COUNT]; static void * worker_thread (void *arg) { - unsigned int id = (unsigned int) (unsigned long) arg; + unsigned int id = (unsigned int) (uintptr_t) arg; int i, j, repeat; unsigned int values[KEYS_COUNT]; @@ -172,7 +173,7 @@ test_tls (void) /* Spawn the threads. */ for (i = 0; i < THREAD_COUNT; i++) - threads[i] = gl_thread_create (worker_thread, NULL); + threads[i] = gl_thread_create (worker_thread, (void *) (uintptr_t) i); /* Wait for the threads to terminate. */ for (i = 0; i < THREAD_COUNT; i++)