Module Name:    src
Committed By:   joerg
Date:           Fri Jul 21 16:39:20 UTC 2017

Modified Files:
        src/tests/libexec/ld.elf_so: h_thread_local_dtor.c

Log Message:
Avoid a race condition between dlclose and thread termination.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/h_thread_local_dtor.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/libexec/ld.elf_so/h_thread_local_dtor.c
diff -u src/tests/libexec/ld.elf_so/h_thread_local_dtor.c:1.1 src/tests/libexec/ld.elf_so/h_thread_local_dtor.c:1.2
--- src/tests/libexec/ld.elf_so/h_thread_local_dtor.c:1.1	Tue Jul 11 15:21:36 2017
+++ src/tests/libexec/ld.elf_so/h_thread_local_dtor.c	Fri Jul 21 16:39:20 2017
@@ -75,10 +75,6 @@ main(void)
 	pthread_cond_wait(&cond1, &mutex);
 	pthread_mutex_unlock(&mutex);
 
-	pthread_mutex_lock(&mutex);
-	pthread_cond_signal(&cond2);
-	pthread_mutex_unlock(&mutex);
-
 	printf("before dlclose\n");
 	dlclose(dso);
 	printf("after dlclose\n");
@@ -86,6 +82,11 @@ main(void)
 	if (dso == NULL)
 		errx(1, "%s", dlerror());
 	dlclose(dso);
+
+	pthread_mutex_lock(&mutex);
+	pthread_cond_signal(&cond2);
+	pthread_mutex_unlock(&mutex);
+
 	if (pthread_join(thread, NULL))
 		err(1, "pthread_join");
 	return 0;

Reply via email to