All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] error creating a task with rt_task_spawn
@ 2008-06-24 12:36 Karl Reichert
  2008-06-24 12:50 ` Sebastian Smolorz
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Reichert @ 2008-06-24 12:36 UTC (permalink / raw)
  To: xenomai

Hello,

I'm trying to create and start a new thread via rt_task_spawn() but I always get error -3. ("Unknown error: -3")

Any idea?


Thanks in advance
Karl





#include "main.h"

#include <stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
#include <native/mutex.h>
#include <sys/mman.h>

int i,j,x;
RT_TASK *rx_tsk;

int ret1;
int ret2;

void rx_task(void *cookie);
void cleanup(int dummy);

int main (int argc, char* argv[])
{
	i = 0;
   
   if ( -1 == mlockall (MCL_CURRENT | MCL_FUTURE) ) {
        perror("mlockall: ");
        return -1;
   }

	ret1 = rt_task_spawn(rx_tsk, "rx_task", 0, 1, T_FPU|T_CPU(1), &rx_task, NULL);
	if( ret1 != 0 )
	{
      switch(ret1)
      {
         case -ENOMEM: printf("no memory!\n");
            break;
         case -EEXIST: printf("already registered!\n");
            break;
         case -EPERM: printf("asychron context!\n");
            break;
         default: printf("Unknown error: %i\n", ret1);
            break;
      }
      return -2;
	}

	for(;i<10000;)
	{
		x=i/23%2;
		i++;
		
	}
		
	ret2 = rt_task_delete(rx_tsk);
	if( 0 != ret2 )
	{
		printf("delete error: %i\n", ret2);
      return -3;
	}

	return 0;
}

void rx_task(void *cookie)
{
	j=0;
	j++;
	while(1);
}

-- 
von Karl Reichert



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-24 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 12:36 [Xenomai-help] error creating a task with rt_task_spawn Karl Reichert
2008-06-24 12:50 ` Sebastian Smolorz
2008-06-24 13:00   ` Karl Reichert
2008-06-24 13:16     ` Sebastian Smolorz

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.