* [Xenomai-help] rt_task_spawn how to
@ 2005-12-28 0:22 Patrice Congo
0 siblings, 0 replies; 3+ messages in thread
From: Patrice Congo @ 2005-12-28 0:22 UTC (permalink / raw)
To: xenomai
Hi all,
is it possible to spawn a task from another rt task?
The following code tries but the spawner task get
blocked:
<code>
#include <string.h>
#include <stdio.h>
#include <native/task.h>
//#include <general_macros.h>
#define STACK_SIZE 8192
RT_TASK spawner;
RT_TASK spawnee;
void spawner_work(void* c);
void spawnee_work(void* c);
void spawner_work(void* c)
{
printf("\nspawner\n");
//SWITCH_TASK_TO_SECONDARY_MODE();
int
ret=rt_task_spawn(&spawnee,"spawnee",STACK_SIZE,50,0,spawnee_work,NULL);
printf("IN SPAWNER WORK: ret=%d
%s\n",ret,strerror(ret));
}
void spawnee_work(void* c)
{
printf("I am spawnee");
}
int main(int argc, char *argv[])
{
int ret=
rt_task_spawn(&spawner,"spawner",STACK_SIZE,50,0,spawner_work,NULL);
printf("\nIN MAIN:ret=%d %s\n",ret,strerror(-ret));
getchar();
return 0;
}
</code>
The resulting output is:
<output>
spawner
IN MAIN:ret=0 Success
</output>
Thie means the resulting the task "spawner" starts but
is blocked at rt_task_spawn.
switching context explicitely to primary or secondary
does not help too.
do you see some mistakes? can you help?
thanks in advance, patrice
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Xenomai-help] rt_task_spawn how to
@ 2005-12-28 0:41 Patrice Congo
2005-12-28 11:36 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Patrice Congo @ 2005-12-28 0:41 UTC (permalink / raw)
To: xenomai
Hi all,
is it posible to spawn a task from another rt task?
The following code tries to, but does not succeed:
<code>
#include <string.h>
#include <stdio.h>
#include <native/task.h>
//#include <general_macros.h>
#define STACK_SIZE 8192
RT_TASK spawner;
RT_TASK spawnee;
void spawner_work(void* c);
void spawnee_work(void* c);
void spawner_work(void* c)
{
printf("\nspawner\n");
//SWITCH_TASK_TO_SECONDARY_MODE();
int
ret=rt_task_spawn(&spawnee,"spawnee",STACK_SIZE,50,0,spawnee_work,NULL);
printf("IN SPAWNER WORK: ret=%d
%s\n",ret,strerror(ret));
}
void spawnee_work(void* c)
{
printf("I am spawnee");
}
int main(int argc, char *argv[])
{
int ret=
rt_task_spawn(&spawner,"spawner",STACK_SIZE,50,0,spawner_work,NULL);
printf("\nIN MAIN:ret=%d %s\n",ret,strerror(-ret));
getchar();
return 0;
}
</code>
the resulting output is:
<output>
spawner
IN MAIN:ret=0 Success
</output>
This means that the task "spawner" starts but get
blocked at rt_task_spwan call.
Switching context explicitely to secondary or to
primary does not help too.
can you help?
best, patrice
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] rt_task_spawn how to
2005-12-28 0:41 [Xenomai-help] rt_task_spawn how to Patrice Congo
@ 2005-12-28 11:36 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2005-12-28 11:36 UTC (permalink / raw)
To: Patrice Congo; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]
Hi Patrice,
Patrice Congo wrote:
> Hi all,
>
> is it posible to spawn a task from another rt task?
> The following code tries to, but does not succeed:
> <code>
> #include <string.h>
> #include <stdio.h>
>
> #include <native/task.h>
> //#include <general_macros.h>
>
> #define STACK_SIZE 8192
>
> RT_TASK spawner;
> RT_TASK spawnee;
> void spawner_work(void* c);
> void spawnee_work(void* c);
>
> void spawner_work(void* c)
> {
> printf("\nspawner\n");
> //SWITCH_TASK_TO_SECONDARY_MODE();
> int
> ret=rt_task_spawn(&spawnee,"spawnee",STACK_SIZE,50,0,spawnee_work,NULL);
> printf("IN SPAWNER WORK: ret=%d
> %s\n",ret,strerror(ret));
> }
>
> void spawnee_work(void* c)
> {
> printf("I am spawnee");
> }
>
> int main(int argc, char *argv[])
> {
> int ret=
>
> rt_task_spawn(&spawner,"spawner",STACK_SIZE,50,0,spawner_work,NULL);
> printf("\nIN MAIN:ret=%d %s\n",ret,strerror(-ret));
> getchar();
> return 0;
> }
>
>
> </code>
>
> the resulting output is:
> <output>
> spawner
>
> IN MAIN:ret=0 Success
>
> </output>
> This means that the task "spawner" starts but get
> blocked at rt_task_spwan call.
Hmm, strange. This is what I see with latest SVN checkout of Xenomai:
spawner
IN SPAWNER WORK: ret=0 Success
I am spawnee
IN MAIN:ret=0 Success
Looks fine.
But you are lacking mlockall() in your demo. Maybe some page fault is
hitting your spawnee during creation.
>
> Switching context explicitely to secondary or to
> primary does not help too.
>
> can you help?
>
> best, patrice
>
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-12-28 11:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-28 0:41 [Xenomai-help] rt_task_spawn how to Patrice Congo
2005-12-28 11:36 ` Jan Kiszka
-- strict thread matches above, loose matches on Subject: below --
2005-12-28 0:22 Patrice Congo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.