* [PATCH 1/2] lib/cobalt: start helper thread with signals blocked
@ 2019-06-14 10:23 Norbert Lange
2019-06-14 10:23 ` [PATCH 2/2] lib/cobalt: set name for printf thread to help debugging Norbert Lange
0 siblings, 1 reply; 3+ messages in thread
From: Norbert Lange @ 2019-06-14 10:23 UTC (permalink / raw)
To: xenomai
Delivery mechanisms like sigwait and signalfd require *all* threads
to block the relevant signals.
The cobalt init should not spawn a thread affecting the
signal-handling.
Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
---
lib/cobalt/printf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index e109deaec..33ff7f9ac 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <limits.h>
#include <pthread.h>
+#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -640,9 +641,13 @@ static void *printer_loop(void *arg)
static void spawn_printer_thread(void)
{
pthread_attr_t thattr;
+ sigset_t sset, oset;
pthread_attr_init(&thattr);
+ sigfillset(&sset);
+ pthread_sigmask(SIG_BLOCK, &sset, &oset);
pthread_create(&printer_thread, &thattr, printer_loop, NULL);
+ sigprocmask(SIG_SETMASK, &oset, NULL);
}
void cobalt_print_init_atfork(void)
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] lib/cobalt: set name for printf thread to help debugging
2019-06-14 10:23 [PATCH 1/2] lib/cobalt: start helper thread with signals blocked Norbert Lange
@ 2019-06-14 10:23 ` Norbert Lange
2019-06-14 16:34 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Norbert Lange @ 2019-06-14 10:23 UTC (permalink / raw)
To: xenomai
Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
---
lib/cobalt/printf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index 33ff7f9ac..7426f2bda 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -648,6 +648,7 @@ static void spawn_printer_thread(void)
pthread_sigmask(SIG_BLOCK, &sset, &oset);
pthread_create(&printer_thread, &thattr, printer_loop, NULL);
sigprocmask(SIG_SETMASK, &oset, NULL);
+ pthread_setname_np(printer_thread, "cobalt_printf");
}
void cobalt_print_init_atfork(void)
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] lib/cobalt: set name for printf thread to help debugging
2019-06-14 10:23 ` [PATCH 2/2] lib/cobalt: set name for printf thread to help debugging Norbert Lange
@ 2019-06-14 16:34 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2019-06-14 16:34 UTC (permalink / raw)
To: Norbert Lange, xenomai
On 14.06.19 12:23, Norbert Lange via Xenomai wrote:
> Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
> ---
> lib/cobalt/printf.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
> index 33ff7f9ac..7426f2bda 100644
> --- a/lib/cobalt/printf.c
> +++ b/lib/cobalt/printf.c
> @@ -648,6 +648,7 @@ static void spawn_printer_thread(void)
> pthread_sigmask(SIG_BLOCK, &sset, &oset);
> pthread_create(&printer_thread, &thattr, printer_loop, NULL);
> sigprocmask(SIG_SETMASK, &oset, NULL);
> + pthread_setname_np(printer_thread, "cobalt_printf");
> }
>
> void cobalt_print_init_atfork(void)
>
Thanks, both applied.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-14 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 10:23 [PATCH 1/2] lib/cobalt: start helper thread with signals blocked Norbert Lange
2019-06-14 10:23 ` [PATCH 2/2] lib/cobalt: set name for printf thread to help debugging Norbert Lange
2019-06-14 16:34 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.