All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Printf stops working after receiving signal.
@ 2009-09-24 19:25 Steve Deiters
  2009-09-24 19:43 ` Gilles Chanteperdrix
  2009-09-24 19:48 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Deiters @ 2009-09-24 19:25 UTC (permalink / raw)
  To: xenomai

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;
}


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

end of thread, other threads:[~2009-09-25 15:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24 19:25 [Xenomai-help] Printf stops working after receiving signal Steve Deiters
2009-09-24 19:43 ` Gilles Chanteperdrix
2009-09-24 19:48 ` Gilles Chanteperdrix
2009-09-24 23:10   ` Steve Deiters
2009-09-25  7:26     ` Gilles Chanteperdrix
2009-09-25 14:33       ` Steve Deiters
2009-09-25 15:05         ` Gilles Chanteperdrix

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.