|
|
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: