On Tue, 2019-11-19 at 17:05 +0100, Jan Kiszka wrote:
> On 19.11.19 17:01, Mauro Salvini wrote:
> > On Tue, 2019-11-19 at 16:41 +0100, Jan Kiszka wrote:
> > > On 19.11.19 16:29, Mauro Salvini via Xenomai wrote:
> > > > 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());
> > > 
> > > This fills the internal data structure RT_TASK with the content
> > > of
> > > another one. Rather than "cloning", did you try using a reference
> > > as
> > > the
> > > API suggests? If that worked in Xenomai 2, it was luck.
> > > 
> > 
> > Hi Jan,
> > 
> > thanks for your answer.
> > Yes, I tried it and even does not work. Changing code in this way:
> > 
> > #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;
> > }
> > 
> > returns:
> > 
> > ./test
> >   task create: 0
> > Task created.
> >   task start: 0
> >   task join : -3
> > 
> 
> OK, then we have a regression. Let me check...
> 
> Jan
> 

Thank you Jan for the patch.

Regards
-- 
Mauro

Reply via email to