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

Background threads

A thread can also be created by running a command in the background with the ``&'' operator. In this case the thread is a child of the thread that created it.

For example, the following illustration shows the inheritance tree for a thread created when the user double-clicks on a clock icon in the home directory window with the following icon_rules clause:

   icon_rules
   {
      clock
      {
         trigger_action: activate
         {
            for_info hello &
            xclock
         }
      }
   }

Thread T1 will create the new thread T2. This will display the for_info dialog box. Thread T1 will then run xclock, and will stay blocked until the xclock window is closed. Thread T1 will then terminate.

Thread T2 will block until the user closes the for_info dialog by clicking on the OK button.

Several commands may be run in the background by enclosing them in ``{ }'' and putting ``&'' after the closing bracket, as in:

   { string='Hello'
     for_info $string
   } &
In the parent thread the name of the child thread is placed in the local variable last_background_action and the parent does not wait for the child to terminate.

See also:


Next topic: Pipelines
Previous topic: Window threads

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 26 May 2005