# killed

The operation is used to wait for (a) given parallel test component(s) to terminate execution.

- Used as a stand-alone statement, it blocks program execution until the component finishes executing the function.
- Used in the body of an alt statement, it does not block TTCN-3 program execution, i.e., it reflects the momentarily state of the component.
- The keyword any is used if it does not matter which component terminates executiuon.
- The keyword all
- The killed operation can address parallel test components only.

The killed operation means the same for both normal and alive parallel test components.

When a parallel test component is killed then it is also done (i.e. done operation does not block), not running and not alive (i.e. both running and alive operations return false), neither.

Related keywords:

- alive
- all
- alt
- any
- component
- create
- done
- kill
- running
- stop

### component_reference.killed;

- The component_reference is one of the following:

  - a reference returned by the create operation to refer to a given parallel test component,
  - the keyword pair all component to check whether all parallel test components have finished execution,

  - the keyword pair any component to check whether at least one parallel test has finished execution.

- The killed keyword denotes that (a) component(s) should be checked.

Examples

Example 1a

vc_AncienVolcan.killed;

The program execution is suspended until the component with reference vc_AncienVolcan has terminated (i.e. killed).

Example 1b:

all component.killed;

The program execution is suspended until all parallel components terminated.

Example 1c:

[] any component.killed { â¦ };

This alternative in the alt statement will be invoked when any of the components has just been terminated.

Example 2

var PTCType_CT vc_myAlivePtc := PTCType_CT.create alive;
vc_myAlivePtc.start(f_myPtcFunction1());
vc_myAlivePtc.done;
vc_myAlivePtc.start(f_myPtcFunction2());
vc_myAlivePtc.killed;

The above example shows the difference between the use of done and killed operations. While done waits for a component for being finished, stopped or killed, the killed operation waits for the componenent being killed only. Exchanging the done with killed would wait for `vc_myAlivePtc` to be killed, which must happen externally, and then exit with error for the 2nd start operation as when a component is killed it cannot be used to execute functions any more.

BNF definition of killed