public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/vineet/arc-port-latest] htl: avoid cancelling threads inside critical sections
@ 2020-07-07 22:03 Vineet Gupta
0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2020-07-07 22:03 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=726117e01b59b129d471304fec4bf78fa280ff9e
commit 726117e01b59b129d471304fec4bf78fa280ff9e
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat Jun 27 02:34:18 2020 +0200
htl: avoid cancelling threads inside critical sections
Like hurd_thread_cancel does.
* sysdeps/mach/hurd/htl/pt-docancel.c: Include <hurd/signal.h>
(__pthread_do_cancel): Lock target thread's critical_section_lock and ss
lock around thread mangling.
Diff:
---
sysdeps/mach/hurd/htl/pt-docancel.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sysdeps/mach/hurd/htl/pt-docancel.c b/sysdeps/mach/hurd/htl/pt-docancel.c
index 93961060a2..52010b6edf 100644
--- a/sysdeps/mach/hurd/htl/pt-docancel.c
+++ b/sysdeps/mach/hurd/htl/pt-docancel.c
@@ -17,6 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
+#include <hurd/signal.h>
#include <pt-internal.h>
#include <pthreadP.h>
@@ -47,10 +48,16 @@ __pthread_do_cancel (struct __pthread *p)
else
{
error_t err;
+ struct hurd_sigstate *ss = _hurd_thread_sigstate (p->kernel_thread);
+
+ __spin_lock (&ss->critical_section_lock);
+ __spin_lock (&ss->lock);
err = __thread_suspend (p->kernel_thread);
assert_perror (err);
+ __spin_unlock (&ss->lock);
+
err = __thread_abort (p->kernel_thread);
assert_perror (err);
@@ -60,6 +67,8 @@ __pthread_do_cancel (struct __pthread *p)
err = __thread_resume (p->kernel_thread);
assert_perror (err);
+
+ _hurd_critical_section_unlock (ss);
}
return 0;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-07 22:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 22:03 [glibc/vineet/arc-port-latest] htl: avoid cancelling threads inside critical sections Vineet Gupta
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).