DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing Deskshell commands

Local variables

Each thread can use local variables, which are distinct from the local variables in other threads. For example, consider the following icon_rules clause:

   icon_rules
   {
      demo /F
      {
         trigger_action: activate
         {
            xs=x
            until == $xs xxxxxx
            do
               for_info 'In activate: '^$xs
               xs=x^$xs
            done
         }
         trigger_action: alt_activate
         {
            xs=x
            until == $xs xxxxxx
            do
               for_info 'In alt_activate: '^$xs
               xs=x^$xs
            done
         }
      }
   }

If the user double-clicks on the demo icon with mouse button 1 and then again with mouse button 2, two threads will be created to execute the commands in the two trigger_action clauses. In whatever order the user presses OK on each dialog, the two instances of the local variable xs are kept separate, and changes to its value in one thread do not affect its value in the other thread.

See also:


Next topic: Global variables
Previous topic: The state of threads

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003