Ivan,

Yes, rtl_no_interrupts(flags) makes sure there will be no
preemption. So:

rtl_no_interrupts(flags);
access variables();
rtl_restore_interrupts(flags);

Note that on an SMP system, you will also need to get a
spinlock to prevent concurrent access from another CPU.

Michael.

Ivan Martinez ([EMAIL PROTECTED]) wrote:
> Stuart Hughes wrote:
> > 
> > Ivan Martinez wrote:
> > >
> > >         Hello!
> > >         I have some real time tasks/threads sharing some variables, so I would
> > > like to prevent them from being interrupted by other task when reading
> > > or writing them. How can I do that?. Do I get what I want with
> > > "rtl_no_iterrupts"?.
> > >         Thank you!.
> > 
> > Hi Ivan,
> > 
> > I use the following wrappers:
> > 
> > #ifdef CONFIG_RTL
> > 
> > #include <asm/rtl_sync.h>
> > #undef cli()
> > #undef sti()
> > #undef save_flags(x)
> > #undef restore_flags(x)
> > #define sti()
> > #define cli()
> > #define save_flags(x)  rtl_hard_savef_and_cli(x)
> > #define restore_flags(x) rtl_hard_restore_flags(x)
> > 
> > #else
> > .....
> > 
> > Then you can just use save_flags(flags) and restore_flags(flags) pairs.
> > It works on a uniprocessor, but there may well be a better way.
> > 
> > Regards, Stuart
> 
>       I can't understand very well what you do with that. Could somebody
> explain me a bit about it?. Any simpler way of doing what I want?. Thank
> you.
> 
> -- 
> Ivan Martinez (Rodriguez)
> Bch in Computer Science - MSc student
> http://www.student.dtu.dk/~u990873
> "Got fabes?"
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to