About the reasons for setting the timer-internal thread with the THREADOBJ_IRQCONTEXT flag.

孙世龙 sunshilong sunshilong369 at gmail.com
Wed Sep 2 11:12:38 CEST 2020


Hi,

>That is a (reasonable) design decision because you would otherwise risk
>that a handler registered for low-prio task can block the delivery of an
>event for a high-prio task. I would just be a mess, at least in a more
>complex RT application.

I see, thank you for the clarification.

It causes what can be done in the callback function of the alarm is very
limited since a lot of APIs can not be invoked(i.e.:
No data synchronization could be done by locking/unlocking RT_Mutex.
Message pipe services(RT_QUEUE), Semaphore services(RT_SEM) and etc
could not be called, too.)

Am I right?

Best regards
Sunshilong


On Wed, Sep 2, 2020 at 3:08 PM Jan Kiszka <jan.kiszka at siemens.com> wrote:
>
> On 01.09.20 11:11, 孙世龙 sunshilong via Xenomai wrote:
> > Hi,
> >
> > I found that the timer-internal thread is set with the
> > THREADOBJ_IRQCONTEXT flag.
> > Here is the related code snippet:
> > static int server_prologue(void *arg)
> > {
> >    svpid = get_thread_pid();
> >    copperplate_set_current_name("timer-internal");
> >    timersv_init_corespec();
> >    threadobj_set_current(THREADOBJ_IRQCONTEXT);
> >
> >    return 0;
> > }
> >
> > Could you please tell me the reasons for setting the timer-internal
> > thread with the THREADOBJ_IRQCONTEXT flag.
> >
> > What are the potential problems if not setting this flag?
> > (I want to make it possible to call rt_task_sleep in the callback
> > function of the timer which is created by rt_alarm_create.)
> >
>
> "
>  * Alarm handlers are always called on behalf of Xenomai's internal
>  * timer event routine. Therefore, Xenomai routines which can be
>  * called from such handlers are restricted to the set of services
>  * available on behalf of an asynchronous context.
> "
>
> That is a (reasonable) design decision because you would otherwise risk
> that a handler registered for low-prio task can block the delivery of an
> event for a high-prio task. I would just be a mess, at least in a more
> complex RT application.
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE
> Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list