1 Reply Latest reply: Feb 1, 2009 4:39 PM by 807557 RSS

    How can a RealtimeThread T1 acces to a var declared in an other RealtimeTh

    807557
      Hi every one,

      I have a problem with my 2 Realtime threads, in the first i had declared a int "i", in the second an other int "j", but to get the value of "j" i need the value of "i".

      It seems that the function executeInArea() concerns only parents so what function to use !!!
      Is it impossible to acces to an outside area to get values ?

      thank you.
        • 1. Re: How can a RealtimeThread T1 acces to a var declared in an other RealtimeTh
          807557
          _sanaa_ wrote:
          Hi every one,

          I have a problem with my 2 Realtime threads, in the first i had declared a int "i", in the second an other int "j", but to get the value of "j" i need the value of "i".
          I don't quite follow. If you've declared a subclass of RealtimeThread that stores a value i then you need to add an accessor method to get it eg: int getI() { return i;}; and the same for j. You then need to allow the thread to get a reference to the other thread. How you do that depends on your application logic - if you are sharing data across threads then the data must be put somewhere that is accessible to all the threads involved.
          It seems that the function executeInArea() concerns only parents so what function to use !!!
          executeInArea allows you to jump up the scopestack to change the current allocation context - typically used to jump to a longer-lived memory area to store a result a some computation that is performed in a short-lived memory area.
          Is it impossible to acces to an outside area to get values ?
          I don't understand what you mean exactly. To access a scope it must be in your scopestack. To get a scope on your scopestack you must enter it (or acquire an inherited scopestack upon creation) using the same path (ie chain of parent scopes) as used by other threads.

          David Holmes