public ScheduledTaskRecord(FrameContext frame, ISubscheduledContinuation continuation, TaskEventRecord submitterReceipt) { Frame = frame; Continuation = continuation; SubmitterReceipt = submitterReceipt; }
// Call this for a continuation that has been previously blocked with NotifyBlocked. This won't // immediately resume the script, but will set it up to be run in interpreter's tick interval. public void NotifyUnblocked(FrameContext frame, ISubscheduledContinuation continuation) { transferRecord(frame, blocked, unblocked, continuation); }
// Use to cooperatively stop running for just a single tick. public void SetYielded(FrameContext frame, ISubscheduledContinuation continuation) { transferRecord(frame, active, yielded, continuation); }
private void transferRecord(FrameContext frame, List <ScheduledTaskRecord> fromRecords, List <ScheduledTaskRecord> toRecords, ISubscheduledContinuation continuation) { var recordIdx = findTaskRecordIndex(frame, fromRecords); ScheduledTaskRecord record = fromRecords[recordIdx]; record.Continuation = continuation; fromRecords.RemoveAt(recordIdx); toRecords.Add(record); }