C# (CSharp) kOS.Safe.Execution Namespace

Classes

Name Description
CPU
CPU.BootGlobalPath
InternalPath
ProgramContext
Stack
YieldFinishedDetector 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.)
YieldFinishedGameTimer A kind of YieldFinishedDetector for use when you just want a 'dumb' timer based on the KSP game clock (note: uses the game's notion of simulated time rather than the real-time wall clock. I.e. the timer is frozen for the duration of a FixedUpdate, and doesn't move at all if the game is paused, etc.).

You'd have to make a slightly different derivative of YieldFinishedDetector in order to base your timer on the out-of-game wall clock.
YieldFinishedGetChar Description of YieldFinishedGetChar.
YieldFinishedNextTick A kind of YieldFinishedDetector for when you want to wait literaly just until the next tick, by returning true unconditionally when asked "are you done".