public object arg; // void *arg public PollProcedure(PollProcedure next, double nextTime, PollHandler handler, object arg) { this.next = next; this.nextTime = nextTime; this.procedure = handler; this.arg = arg; }
/// <summary> /// NET_Poll /// </summary> public static void Poll() { SetNetTime(); for (PollProcedure pp = _PollProcedureList; pp != null; pp = pp.next) { if (pp.nextTime > _Time) { break; } _PollProcedureList = pp.next; pp.procedure(pp.arg); } }
/// <summary> /// SchedulePollProcedure /// </summary> static void SchedulePollProcedure(PollProcedure proc, double timeOffset) { proc.nextTime = Sys.GetFloatTime() + timeOffset; PollProcedure pp, prev; for (pp = _PollProcedureList, prev = null; pp != null; pp = pp.next) { if (pp.nextTime >= proc.nextTime) { break; } prev = pp; } if (prev == null) { proc.next = _PollProcedureList; _PollProcedureList = proc; return; } proc.next = pp; prev.next = proc; }