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> /// 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; }
public Network(Host host) { Host = host; _SlistSendProcedure = new PollProcedure(null, 0.0, SlistSend, null); _SlistPollProcedure = new PollProcedure(null, 0.0, SlistPoll, null); // Temporary workaround will sort out soon NetworkWrapper.OnGetLanDriver += (index) => { return(LanDrivers[index]); }; }
/// <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> /// 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); } }
public PollHandler procedure; // void (*procedure)(); #endregion Fields #region Constructors public PollProcedure(PollProcedure next, double nextTime, PollHandler handler, object arg) { this.next = next; this.nextTime = nextTime; this.procedure = handler; this.arg = 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; }