Skip to contentSkip to conversation

help with alarams

Xenomai-help Prashanti Bedapudi 1 participant 1 message May 5, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I am new to xenomai and linux. I am having some problems with alarms. Here is a sample piece of code that I am using.

If you look at the main function, I have a while(!quit_now) and I am setting this flag in the alarm_handler. I am seeing some weird results. When I have a printf statement in the while(!quit_now) loop as I have below, it works as expected and the program terminates when the quit_flag is set. But if I remove the printf() the program never terminates, it just hangs, even if the quit_now flag is set.

Any insight into this problem will be greatly appreciated.

alarm_handler()

{
        for(;;)
        {
           rt_alarm_wait();
           do_processing();
           if(condition met)
           {
               quit_now = TRUE;  /* global variable */
               break;
           }
        }
}

main()

{
        rt_alarm_create;
        rt_task_spawn();
        rt_alarm_start();
 
        while(!quit_now)
          printf("Inside while\n");
}

thanks in advance,

Shanti