volatile in struct

Sergei Organov osv at topconrd.ru
Wed Feb 18 08:50:34 UTC 2004


Juergen Zeller <juergen.zeller at argovision.de> writes:
> Thank you for all your statements. But this is not the key for my question.
> Unfortunately somebody cut out my first mail, so I'm not wondering something
> 'other' is discussed. Here my first questiion again:

It has been answered already. Here is the initial answer:

1. You should protect your shared data with *the same* primitive in all the
   threads. Either use rtems_interrupt_x in both threads or use
   rtems_semaphore_x in both threads.

2. Using volatile is almost never a good idea. If you use RTOS primitives for
   mutual exclusion correctly, you don't need volatile for your protected
   data.

-- 
Sergei.




More information about the users mailing list