Hi all,

I'm using Xenomai 3.0.9 in cobalt mode and I'm facing an issue on
rt_task_self() returned value.

Please see this simple code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alchemy/task.h>

RT_TASK gNewTask;

static void Task(void *lpArgument)
{
        rt_printf("Task created.\n");
        gNewTask = *(rt_task_self());
}

int main()
{
        RT_TASK tNewTask;
        int err = rt_task_create(&tNewTask, "TEST", 16384, 10,
T_JOINABLE);
        rt_printf(" task create: %d\n", err);
        err = rt_task_start(&tNewTask, Task, NULL);
        rt_printf(" task start: %d\n", err);
        
        rt_task_sleep(2000000000);

        //err = rt_task_join(&tNewTask);
        err = rt_task_join(&gNewTask);
        rt_printf(" task join : %d\n", err);

        return 0;
}

Code is compiled using xeno-config --alchemy.

Using the rt_task_self() returned value with rt_task_join(), the latter
returns -ESRCH (no such process). Obviously if I use the local tNewTask
variable, return value is 0.

I'm pretty sure that this works without errors with Xenomai2.

Is it the expected behavior with Xenomai3?

Thanks in advance, regards
-- 
Mauro

Reply via email to