Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Philippe Gerum wrote:
>>>>> Well, what about merging the solutions: trap the signal from the library
>>>>> constructor by default for people relying on #1, AND document the shadow 
>>>>> signal
>>>>> handler for people who can do #2?
>>>> For me, merging the two, would mean keep sigshadow_install called upon
>>>> thread creation, but export xeno_sigwinch_handler to be callable from
>>>> user signals.
>>>> This way, if people install their signal handler before the first thread
>>>> creation, they have nothing to worry about. If they install their signal
>>>> handler at a later time, they have to take care of calling
>>>> xeno_sigwinch_handler and look at its return value.
>>> Jan, do you agree? The main argument is that people may use third-party
>>> libraries such as, say, libreadline or libqt which intercept the
>>> SIGWINCH signal, and that we do not want to recompile these libraries to
>>> run with Xenomai.
>> Yes, I'm fine with the current approach + doc + xeno_sigwinch_handler.
> Ok. Since I am going to paste the doc in four different places, I'd 
> better get it right from the beginning. Here is my prose:
>  * @note: When creating or shadowing a Xenomai thread in user-space, for the
>  * first time, Xenomai installs a handler for the SIGWINCH signal. If you had
>  * installed a handler before that, it will be automatically called by Xenomai
>  * for SIGWINCH signals that it has not sent.
>  *
>  * If, however, you install a signal handler for SIGWINCH after creating
>  * or shadowing the first Xenomai thread, you have to explicitely call the

(I regularly mistype this as well...)

>  * function xeno_sigwinch_handler at the beginning of your signal handler,
>  * using its return to know if the signal was in fact an internal signal of
>  * Xenomai (in which case it returns 1), or if you should handle the signal 
> (in
>  * which case it returns 0). xeno_sigwinch_handler prototype is:
>  *
>  * <b>int xeno_sigwinch_handler(int sig, siginfo_t *si, void *ctxt);</b>
>  *
>  * Which means that you should register your handler with sigaction, using the
>  * SA_SIGINFO flag, and pass all the arguments you received to
>  * xeno_sigwinch_handler.

Sounds good to me.


Attachment: signature.asc
Description: OpenPGP digital signature

Xenomai-core mailing list

Reply via email to