C# (CSharp) kOS.Safe.Execution YieldFinishedDetector - 2 примера найдено. Это лучшие примеры C# (CSharp) кода для kOS.Safe.Execution.YieldFinishedDetector, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
When telling kOS's CPU that it should yield, using the CPU.YieldProgram() method, you make a new instance of a derivative of this class to manage the decision of when it should resume again. kOS's CPU will repeatedly re-check the instance of this class whenever it wants to execute Opcodes, and only when this class says so will it resume execution of the Opcodes.
When you make a new instance of this class you should immediately "forget" it after it is passed to YieldProgram() (i.e. don't hold a reference to it.) If you call YieldProgram() again, it should always be a with a new instance of this class.
When you inherit from this class, you should store any data values that are part of the decision "am I done waiting" as members of this class, such that each new instance gets its own set of such fields and all instances can decide "am I done" indepentantly of each other.
The reason all the above instructions are relevant is that they allow the same Opcode, or Built-in Function to cause more than one YieldProgram to exist similtaneously from them. (i.e. a Wait Opcode inside a function, and that function gets called from both the mainline code and a trigger. You want two different wait timers going for them even though they're coming from the exact same OpcodeWait instance in the program.)