diff options
author | Bruno Haible <bruno@clisp.org> | 2019-06-20 03:53:51 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-06-20 03:53:51 +0200 |
commit | 97ae5364457c30ea826fa5e6c0c0a41c73a30c38 (patch) | |
tree | a44ab512c75d2b8145848e899c6b6ffbcdda6ad8 | |
parent | a06d50500ce0a3aa39e3cf1a6b4bf0ed3c1d7c88 (diff) | |
download | gnulib-97ae5364457c30ea826fa5e6c0c0a41c73a30c38.tar.gz gnulib-97ae5364457c30ea826fa5e6c0c0a41c73a30c38.tar.bz2 |
tls tests: Small improvements.
* tests/test-tls.c: Include <stdint.h>.
(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.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | modules/tls-tests | 1 | ||||
-rw-r--r-- | tests/test-tls.c | 5 |
3 files changed, 12 insertions, 2 deletions
@@ -1,5 +1,13 @@ 2019-06-20 Bruno Haible <bruno@clisp.org> + tls tests: Small improvements. + * tests/test-tls.c: Include <stdint.h>. + (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 <bruno@clisp.org> + cond tests: Simplify. * tests/test-cond.c (test_timedcond): Remove redundant assignment. 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 <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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++) |