Re: rt_task_self() return value
On 19.11.19 17:30, Mauro Salvini wrote: 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 #include #include #include 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 #include #include #include 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(, "TEST", 16384, 10, T_JOINABLE); rt_printf(" task create: %d\n", err); err = rt_task_start(, Task, NULL); rt_printf(" task start: %d\n", err); rt_task_sleep(20); //err = rt_task_join(); 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. BTW, I only tested the pointer case, but copying the content of RT_TASK should actually work as well. Thanks for reporting! Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Re: rt_task_self() return value
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 > > > > #include > > > > #include > > > > #include > > > > > > > > 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 > > #include > > #include > > #include > > > > 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(, "TEST", 16384, 10, > > T_JOINABLE); > > rt_printf(" task create: %d\n", err); > > err = rt_task_start(, Task, NULL); > > rt_printf(" task start: %d\n", err); > > > > rt_task_sleep(20); > > > > //err = rt_task_join(); > > 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
Re: rt_task_self() return value
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 #include #include #include 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 #include #include #include 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(, "TEST", 16384, 10, T_JOINABLE); rt_printf(" task create: %d\n", err); err = rt_task_start(, Task, NULL); rt_printf(" task start: %d\n", err); rt_task_sleep(20); //err = rt_task_join(); 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 -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Re: rt_task_self() return value
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 > > #include > > #include > > #include > > > > 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 #include #include #include 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(, "TEST", 16384, 10, T_JOINABLE); rt_printf(" task create: %d\n", err); err = rt_task_start(, Task, NULL); rt_printf(" task start: %d\n", err); rt_task_sleep(20); //err = rt_task_join(); 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 Thanks, regards -- Mauro
Re: rt_task_self() return value
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 #include #include #include 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. Jan } int main() { RT_TASK tNewTask; int err = rt_task_create(, "TEST", 16384, 10, T_JOINABLE); rt_printf(" task create: %d\n", err); err = rt_task_start(, Task, NULL); rt_printf(" task start: %d\n", err); rt_task_sleep(20); //err = rt_task_join(); err = rt_task_join(); 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 -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux