public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited 1/2] htl: support cancellation during pthread_once
@ 2020-02-09 19:51 Samuel Thibault
  2020-02-09 19:51 ` [hurd,commited 2/2] pthread: Move most once tests from nptl to sysdeps/pthread Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Thibault @ 2020-02-09 19:51 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

---
 sysdeps/htl/pt-once.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sysdeps/htl/pt-once.c b/sysdeps/htl/pt-once.c
index 0581f7bd6c..7f86e28006 100644
--- a/sysdeps/htl/pt-once.c
+++ b/sysdeps/htl/pt-once.c
@@ -21,6 +21,13 @@
 
 #include <pt-internal.h>
 
+static void
+clear_once_control (void *arg)
+{
+  pthread_once_t *once_control = arg;
+  __pthread_spin_unlock (&once_control->__lock);
+}
+
 int
 __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
 {
@@ -33,7 +40,10 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
 
       if (once_control->__run == 0)
 	{
+	  pthread_cleanup_push (clear_once_control, once_control);
 	  init_routine ();
+	  pthread_cleanup_pop (0);
+
 	  atomic_full_barrier ();
 	  once_control->__run = 1;
 	}
-- 
2.24.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [hurd,commited 2/2] pthread: Move most once tests from nptl to sysdeps/pthread
  2020-02-09 19:51 [hurd,commited 1/2] htl: support cancellation during pthread_once Samuel Thibault
@ 2020-02-09 19:51 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2020-02-09 19:51 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

So they can be checked with htl too.
---
 nptl/Makefile                          | 7 ++-----
 sysdeps/pthread/Makefile               | 6 ++++++
 {nptl => sysdeps/pthread}/tst-once1.c  | 0
 {nptl => sysdeps/pthread}/tst-once2.c  | 0
 {nptl => sysdeps/pthread}/tst-once3.c  | 0
 {nptl => sysdeps/pthread}/tst-once4.c  | 0
 {nptl => sysdeps/pthread}/tst-oncex3.c | 0
 {nptl => sysdeps/pthread}/tst-oncex4.c | 0
 8 files changed, 8 insertions(+), 5 deletions(-)
 rename {nptl => sysdeps/pthread}/tst-once1.c (100%)
 rename {nptl => sysdeps/pthread}/tst-once2.c (100%)
 rename {nptl => sysdeps/pthread}/tst-once3.c (100%)
 rename {nptl => sysdeps/pthread}/tst-once4.c (100%)
 rename {nptl => sysdeps/pthread}/tst-oncex3.c (100%)
 rename {nptl => sysdeps/pthread}/tst-oncex4.c (100%)

diff --git a/nptl/Makefile b/nptl/Makefile
index 8fadd1d025..bf21413c26 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -248,7 +248,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
 	tst-rwlock4 tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 \
 	tst-rwlock9 tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 \
 	tst-rwlock14 tst-rwlock15 tst-rwlock16 tst-rwlock17 tst-rwlock18 \
-	tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \
+	tst-once5 \
 	tst-key1 tst-key2 tst-key3 tst-key4 \
 	tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
 	tst-sem8 tst-sem9 tst-sem10 tst-sem14 \
@@ -375,8 +375,7 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
 	 tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
 	 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
 	 tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
-	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
-	 tst-oncex3 tst-oncex4
+	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4
 ifeq ($(build-shared),yes)
 tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 tst-compat-forwarder \
 	 tst-audit-threads
@@ -516,8 +515,6 @@ CFLAGS-tst-cleanupx2.c += -fexceptions
 CFLAGS-tst-cleanupx3.c += -fexceptions
 CFLAGS-tst-cleanupx4.c += -fexceptions
 CFLAGS-tst-cleanupx4aux.c += -fexceptions
-CFLAGS-tst-oncex3.c += -fexceptions
-CFLAGS-tst-oncex4.c += -fexceptions
 CFLAGS-tst-align.c += $(stack-align-test-flags)
 CFLAGS-tst-align3.c += $(stack-align-test-flags)
 CFLAGS-tst-initializers1.c += -W -Wall -Werror
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 2c33c5c904..6b49e33bdc 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -51,11 +51,17 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
 	 tst-cond23 tst-cond24 tst-cond25 \
 	 tst-cond-except \
 	 tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex6 tst-mutex10 \
+	 tst-once1 tst-once2 tst-once3 tst-once4 \
 	 tst-spin1 tst-spin2 tst-spin3 tst-spin4
 
+tests += tst-oncex3 tst-oncex4
+
 ifeq ($(build-shared),yes)
 tests-static += tst-cond8-static
 tests += tst-cond8-static
 endif
 
+CFLAGS-tst-oncex3.c += -fexceptions
+CFLAGS-tst-oncex4.c += -fexceptions
+
 endif
diff --git a/nptl/tst-once1.c b/sysdeps/pthread/tst-once1.c
similarity index 100%
rename from nptl/tst-once1.c
rename to sysdeps/pthread/tst-once1.c
diff --git a/nptl/tst-once2.c b/sysdeps/pthread/tst-once2.c
similarity index 100%
rename from nptl/tst-once2.c
rename to sysdeps/pthread/tst-once2.c
diff --git a/nptl/tst-once3.c b/sysdeps/pthread/tst-once3.c
similarity index 100%
rename from nptl/tst-once3.c
rename to sysdeps/pthread/tst-once3.c
diff --git a/nptl/tst-once4.c b/sysdeps/pthread/tst-once4.c
similarity index 100%
rename from nptl/tst-once4.c
rename to sysdeps/pthread/tst-once4.c
diff --git a/nptl/tst-oncex3.c b/sysdeps/pthread/tst-oncex3.c
similarity index 100%
rename from nptl/tst-oncex3.c
rename to sysdeps/pthread/tst-oncex3.c
diff --git a/nptl/tst-oncex4.c b/sysdeps/pthread/tst-oncex4.c
similarity index 100%
rename from nptl/tst-oncex4.c
rename to sysdeps/pthread/tst-oncex4.c
-- 
2.24.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-09 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-09 19:51 [hurd,commited 1/2] htl: support cancellation during pthread_once Samuel Thibault
2020-02-09 19:51 ` [hurd,commited 2/2] pthread: Move most once tests from nptl to sysdeps/pthread Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).