Announcement

Collapse
No announcement yet.

Threads and Local Variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Brent Boshart
    replied
    Thanks. I just was not sure what happened when two threads ran the function simultaneously.

    ------------------

    Leave a comment:


  • Steve Hutchesson
    replied
    Brent,

    When you use a LOCAL variable, it is allocated in a section of memory called
    the stack. This allocation takes place as the function/sub is called and it
    is deleted when the function/sub is finished so it simply does not exist
    anywhere else when the function/sub is not running.

    If you need to have a value that is available across diferent functions, use
    a GLOBAL variable that can be "seen" from diferent aprts of your code.

    Regards,

    [email protected]

    ------------------

    Leave a comment:


  • Eric Pearson
    replied
    Yes.

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    Leave a comment:


  • Brent Boshart
    started a topic Threads and Local Variables

    Threads and Local Variables

    If I have two threads running the same function are local variables with the function private for each thread?
Working...
X