[Xenomai] What is the main() thread before you call rt_task_shadow()?

Giulio Moro g.moro at qmul.ac.uk
Sun Jun 11 04:18:08 CEST 2017


Giulio Moro wrote:
>> A side note: it seems that calling `rt_task_bind()` causes a switch to secondary mode, as I see the MSW counter increasing for every call to it.
>> 

Philippe Gerum wrote:
>This should not be the case in x3; you may want to run the app over gdb,
>enabling the T_WARNSW flag at task creation, so that a signal will be
>sent to the process when a mode switch happens. Inspecting the stack
>backtrace should give us a hint about the code causing such switch.

as it turns out, if I call rt_task_shadow() before the loop where I repeatedly call rt_task_bind(), then the mode switches go away.

The description of the --main-prio command line option (http://xenomai.org/2015/05/application-setup-and-init/#Standard_Xenomai_command_line_options) says
"When xenomai_init() is called for bootstrapping the real-time services for the current process, the calling context is automatically turned into a Xenomai thread, managed by the Cobalt kernel."
I assumed that this would be equivalent to a call to `rt_task_shadow()` and that such an explicit call is not needed, given that the process already shows up in /proc/xenomai/sched/stat.
Instead, as I found out above, this is not the case.

So my question is: what kind of task is the main thread after bootstrap (and thus after the call to xenomai_init()), but before the call to rt_task_shadow()?


More information about the Xenomai mailing list