The thread start routine must return void *, and int and void *
are distinct types. Compilers increasingly issue errors instead
of warnings for such type errors, and this causes the configure
probe to fail unconditionally, even if the system supports
__thread variables.
Submitted upstream: <https://github.com/mono/mono/pull/21730>
diff --git a/configure.ac b/configure.ac
index bbbd1622d9728859..5a3a5770c8a3cdb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2833,14 +2833,16 @@ if test x$host_win32 = xno; then
__thread int i;
static int res1, res2;
- void thread_main (void *arg)
+ void *thread_main (void *parg)
{
+ int arg = *(int *)parg;
i = arg;
sleep (1);
if (arg == 1)
res1 = (i == arg);
else
res2 = (i == arg);
+ return NULL;
}
int main () {
@@ -2848,8 +2850,10 @@ if test x$host_win32 = xno; then
i = 5;
- pthread_create (&t1, NULL, thread_main, 1);
- pthread_create (&t2, NULL, thread_main, 2);
+ int one = 1;
+ pthread_create (&t1, NULL, thread_main, &one);
+ int two = 2;
+ pthread_create (&t2, NULL, thread_main, &two);
pthread_join (t1, NULL);
pthread_join (t2, NULL);
--- a/configure 2023-06-14 17:18:48.000000000 +0200
+++ b/configure 2023-12-09 10:41:58.001084368 +0100
@@ -24906,14 +24894,16 @@
__thread int i;
static int res1, res2;
- void thread_main (void *arg)
+ void *thread_main (void *parg)
{
+ int arg = *(int *)parg;
i = arg;
sleep (1);
if (arg == 1)
res1 = (i == arg);
else
res2 = (i == arg);
+ return NULL;
}
int main () {
@@ -24921,8 +24911,10 @@
i = 5;
- pthread_create (&t1, NULL, thread_main, 1);
- pthread_create (&t2, NULL, thread_main, 2);
+ int one = 1;
+ pthread_create (&t1, NULL, thread_main, &one);
+ int two = 2;
+ pthread_create (&t2, NULL, thread_main, &two);
pthread_join (t1, NULL);
pthread_join (t2, NULL);