Module Name: src
Committed By: martin
Date: Fri Sep 1 08:43:22 UTC 2017
Modified Files:
src/tests/libexec/ld.elf_so [netbsd-8]: h_thread_local_dtor.c
Log Message:
Pull up following revision(s) (requested by joerg in ticket #253):
tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.2
Avoid a race condition between dlclose and thread termination.
To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \
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.2.2.2 src/tests/libexec/ld.elf_so/h_thread_local_dtor.c:1.2.2.3
--- src/tests/libexec/ld.elf_so/h_thread_local_dtor.c:1.2.2.2 Tue Aug 29 09:43:16 2017
+++ src/tests/libexec/ld.elf_so/h_thread_local_dtor.c Fri Sep 1 08:43:22 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;