# done

The operation is used to wait for (a) given parallel test component(s) to finish executing the function that is running on this component.

- 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.
- Used as a stand-alone statement, it blocks program execution until the component finishes executing the function.
- The keyword any is used if it does not matter which component terminates executiuon.
- The keyword all is used if all components must finish execution.
- The done operation can address parallel test components only.

The done operation bears a slightly different meaning on the two kinds of parallel test components:

- User for normal parallel test components, it implies that the addressed parallel test component is terminated, since this kind of parallel test component can only be started once. When a normal parallel test component is done then it is killed (i.e. killed operation does not block), not running and not alive (i.e. both running and alive operations return false), neither.
- When an alive parallel test component is done, it can be used to execute additional function(s), thus it is not killed (i.e. killed operation blocks). Consequently, it is alive (i.e. alive operation returns true) but not running (i.e. running operation returns false).

Related keywords:

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

### component_reference.done;

- 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 done keyword denotes that (a) component(s) should be checked.

Examples

Example 1a

vc_AncienVolcan.done;

The program execution is suspended until the component with reference vc_AncienVolcan has finished execution.

Example 1b:

all component.done;

The program execution is suspended until all parallel components have finished execution.

Example 1c:

[] any component.done { â¦ };

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

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.done;
vc_myAlivePtc.kill;

The above example demonstrates how a single parallel test component can be used to execute functions subsequently.

BNF definition of done