I have a simple little test program, attached below.  When I hit CTL-C
to break the program, not all of the "finished" lines will print.  If I
remove either the rt_task_shadow call or the sigwait at the end, it will
then print all of them.  Adding a fflush(stdout) to the end does nothing
to help it.

I'm not sure if there's some interaction with the Xenomai domain I am
just missing which is causing the print statements to be dropped.

This is running on a PowerPC kernel 2.6.24 with Xenoami 2.4.9.

----------------------------------------------------- 
#include <signal.h>
#include <stdio.h>
#include <native/task.h>

static volatile int signaled = 0;

static void catch(int x)
{
   signaled = 1;
}

static RT_TASK rt_main;

int main(int argc, char **argv)
{
   int sig;
   struct sigaction act;
   sigset_t set;
   rt_task_shadow(&rt_main, NULL, 99, 0);

   act.sa_flags = 0;
   act.sa_handler = catch;
   sigemptyset(&act.sa_mask);
   sigaction(SIGINT,&act,NULL);

   printf("starting 1\n");
   printf("starting 2\n");
   printf("starting 3\n");
   printf("starting 4\n");
   printf("starting 5\n");

   while(!signaled)
   {
      sleep(1);
      printf(".");
      fflush(stdout);
   }

   printf("\nfinished 1\n");
   printf("finished 2\n");
   printf("finished 3\n");
   printf("finished 4\n");
   printf("finished 5\n");

   sigfillset(&set);
   sigwait(&set,&sig);

   return 0;
}

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to