terminate Process
If the entity is executing a process and the process is suspended, then the process routine is terminated. This causes the currently suspended process to exit, essentially with an error condition. No further processing within the process will execute. The process ends (is terminated). All resources that the entity has allocated will be deallocated. If the entity was waiting in a queue, the entity is removed from the queue and no statistics are collected on its queueing. If the entity is experiencing a delay, then the event associated with the delay is cancelled.
Termination also releases the entity, not only the things it was entangled with. The entity stops being bound to the terminated process and is left in the process-ended state, exactly as it would be after a process completed normally. It may therefore be given a new process instance, and the natural place to do that is the handleTerminatedProcess() function or the afterTermination argument below, both of which run after the release.
The process instance itself remains one-shot: a terminated process cannot be activated again, for this entity or any other. Repeating the behavior means creating a new process instance for the entity.
If the entity has additional processes in its process sequence they are not automatically executed. If the user requires specific behavior to occur for the entity after termination, then the user should override the Entity's handleTerminatedProcess() function to supply specific logic. Termination happens immediately, with no time delay.
Calling this function when the entity is not currently executing a process does nothing.
Parameters
a function to invoke after the process is successfully terminated. The entity supplied to it has already been released and may be given a new process.