waitFor

abstract suspend fun waitFor(process: KSLProcess, timeUntilActivation: Double = 0.0, priority: Int = PRIORITY, suspensionName: String? = null)

Causes the current process to suspend until the specified process has run to completion. This is like run blocking. It activates the specified process and then waits for it to complete before proceeding.

Parameters

process

the process to start for an entity

timeUntilActivation

the time until the start the process

priority

the priority associated with the event to start the process


abstract suspend fun waitFor(signal: Signal, waitPriority: Int = PRIORITY, waitStats: Boolean = true, suspensionName: String? = null)

Causes the process to halt, waiting for the signal to be announced. Some other process/event is necessary to cause the signal. The entities stop waiting for the signal and resume their processes when signaled.

Parameters

signal

a general indicator for controlling the process

waitPriority

a priority indicator to inform ordering when there is more than one process waiting for the same signal

waitStats

Indicates whether waiting time statistics should be collected on waiting items, true means collect statistics

suspensionName

the name of the waitFor. can be used to identify which waitFor the entity is experiencing if there are more than one waitFor suspension points within the process. The user is responsible for uniqueness.


open suspend fun <T : ModelElement.QObject> BlockingQueue<T>.waitFor(amount: Int = 1, predicate: (T) -> Boolean = alwaysTrue, blockingPriority: Int = PRIORITY, suspensionName: String? = null): List<T>

Permits simpler calling syntax when using a blocking queue within a KSLProcess This method will block (suspend) until the required number of items that meet the criteria become available within the blocking queue.

Parameters

amount

the number of items needed from the blocking queue that match the criteria

predicate

a functional predicate that tests items in the queue for the criteria

blockingPriority

the priority associated with the entity if it has to wait to receive

suspensionName

the name of the suspension point. can be used to identify which receive suspension point the entity is experiencing if there are more than one receive suspension points within the process. The user is responsible for uniqueness.