>From 97ae5364457c30ea826fa5e6c0c0a41c73a30c38 Mon Sep 17 00:00:00 2001
From: Bruno Haible
Date: Thu, 20 Jun 2019 03:53:51 +0200
Subject: [PATCH 03/26] 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.
---
ChangeLog | 8 ++++++++
modules/tls-tests | 1 +
tests/test-tls.c | 5 +++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9472275..b8ff877 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
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.
* tests/test-cond.c (test_timedcond): Remove redundant assignment.
diff --git a/modules/tls-tests b/modules/tls-tests
index 562e36b..b93f673 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 6bfa6ff..0cd6b1d 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++)
--
2.7.4