Is this the actual code you are using? It looks like pseudo code to me.
Please do not post pseudo or sample code, post the actual code you are
using, and then we can help you.

If this is the actual code then I can see these problems:
1) if (condition met) is not good programming because the actual condition
is hidden by the definitions of 'condition' and 'met', which makes the
program too hard to read. I would replace this with the actual condition you
are testing.
2) alarm_handler is never called from the main program. Thus, the while
statement is an infinite loop.

Cheers,
   Chris.

----------------------------------------
Christopher Stone
Principal
Sombrio Systems Inc.
www.openembedded.biz
613-831-1892

> -----Original Message-----
> From: Prashanti Bedapudi [mailto:[EMAIL PROTECTED]
> Sent: May 6, 2006 10:30 PM
> To: [email protected]
> Subject: [Xenomai-help] help with using alarams
> 
> 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.
> 
> I posted this message 2 days ago..but I got a reply with message saying
> 'HTML attachment has been scrubbed'. Not sure what that meant, so I am
> posting it again..
> 
> 
> 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
> 
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> [email protected]
> https://mail.gna.org/listinfo/xenomai-help
> 




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

Reply via email to