Skip to contentSkip to conversation

Signal mask inheritance

Xenomai-help Mauro Salvini 2 participants 3 messages Feb 11, 2011 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi to all,

I would build an application where only one of real-time tasks executes a custom signal handler to respond to a set of signals (ex SIGINT, SIGTERM). Xenomai tasks are also POSIX threads, so I think that at creation they inherits all signal masks and handlers from parent thread. So, what I can do in my app is reset signal mask to block all signals when new task starts.
Can I block all signals or there are some signals (eg SIGWINCH) needed by Xenomai for inter-task communication?

By the way, is there a method in Xenomai to initialize all RT_TASK structure fields without use field names (eg PTHREAD_MUTEX_INITIALIZER )? I use this simple define:

#2 lore raw

I apologize for latter message, my client decides to automatically send it before completion...

I rewrite it here:

Hi to all,

I would build an application where only one of real-time tasks executes a custom signal handler to respond to a set of signals (ex SIGINT, SIGTERM). Xenomai tasks are also POSIX threads, so I think that at creation they inherits all signal masks and handlers from parent thread. So, what I can do in my app is reset signal mask to block all signals when new task starts.
Can I block all signals or there are some signals (eg SIGWINCH) needed by Xenomai for inter-task communication?

By the way, is there a method in Xenomai to initialize all RT_TASK structure fields without use field names (eg PTHREAD_MUTEX_INITIALIZER )? I use this simple define:

#define RT_TASK_RESET(task) task.opaque=0 , task.opaque2=0

but it works only for kernel tasks (in include/native/task.h RT_TASK structure isn't the same for kernel/non kernel tasks). I think that a struct initializer into library could be a next feature.

Thank you,regards.

#3 lore raw
In reply to Mauro Salvini
Quoted 7 lines · Mauro Salvini

Hi to all,

I would build an application where only one of real-time tasks executes a custom signal handler to respond to a set of signals (ex SIGINT, SIGTERM). Xenomai tasks are also POSIX threads, so I think that at creation they inherits all signal masks and handlers from parent thread.

Handlers are per-process, not per-thread.

Quoted 2 lines

So, what I can do in my app is reset signal mask to block all signals when new task starts.

Why do this? Why not only mask the signals you want to handle in the separate thread?

And yes, you must let Xenomai thread handle SIGWINCH

Quoted 3 lines

By the way, is there a method in Xenomai to initialize all RT_TASK structure fields without use field names (eg PTHREAD_MUTEX_INITIALIZER )? I use this simple define:

Well, as you found out, one of the members of the RT_TASK structure is the pthread_t identifier of the corresponding thread, so, how do you figure it would be possible to initialize the RT_TASK in advance before the thread is even created?

And by the way, POSIX has PTHREAD_MUTEX_INITIALIZER, not PTHREAD_INITIALIZER. So, you are comparing things which are not really comparable.

Listen, we do have limited ressources to answer your questions, so please take time to read some documentation, and think a bit before asking questions.

Signature · 1 line
					    Gilles.